From 8fb9f5b9db7a6eb7d418d499a8e34a15d18b7404 Mon Sep 17 00:00:00 2001 From: E44 <129310925+programmer-44@users.noreply.github.com> Date: Sun, 18 Jan 2026 13:28:10 +0100 Subject: [PATCH] refactor(api_handler): better return types, formatting --- control/frontend/src/lib/ts/api_handler.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/control/frontend/src/lib/ts/api_handler.ts b/control/frontend/src/lib/ts/api_handler.ts index 21e18b3..73e88e9 100755 --- a/control/frontend/src/lib/ts/api_handler.ts +++ b/control/frontend/src/lib/ts/api_handler.ts @@ -36,7 +36,7 @@ export async function send_keyboard_input( await request_display(ip, '/keyboardInput', options); } -export async function show_html(ip: string, html: string) { +export async function show_html(ip: string, html: string): Promise { const options = { method: 'PATCH', headers: { 'content-type': 'application/json' }, @@ -110,11 +110,8 @@ export async function get_file_tree_data(ip: string, path: string): Promise { - const command = `mkdir -p ".${path}"` +export async function create_path(ip: string, path: string): Promise { + const command = `mkdir -p ".${path}"`; const raw_response = await run_shell_command(ip, command); if (!raw_response.ok || !raw_response.json) return; @@ -238,7 +235,11 @@ async function request( error_description += '\nCould not parse error description'; } } - notifications.push('error', `Fehler bei API-Anfrage`, `\nHTTP: ${response.status}\n${error_description}`); + notifications.push( + 'error', + `Fehler bei API-Anfrage`, + `\nHTTP: ${response.status}\n${error_description}` + ); } catch (error: unknown) { if (error instanceof TypeError && /fetch|NetworkError/i.test(error.message)) { if (dev) {