mirror of
https://codeberg.org/PLG-Development/PLG-MuDiCS
synced 2026-07-05 16:37:09 +00:00
refactor(control): improve structure in api_handler
This commit is contained in:
@@ -72,6 +72,7 @@ export async function get_file_data(
|
|||||||
const json_response = raw_response.json as ShellCommandResponse;
|
const json_response = raw_response.json as ShellCommandResponse;
|
||||||
if (json_response.exitCode === 0 && json_response.stdout.trim() === '') return [];
|
if (json_response.exitCode === 0 && json_response.stdout.trim() === '') return [];
|
||||||
if (handle_shell_error(ip, json_response, command, true)) return null;
|
if (handle_shell_error(ip, json_response, command, true)) return null;
|
||||||
|
if (json_response.stdout.trim() === '') return null;
|
||||||
|
|
||||||
const response: FileInfo[] = json_response.stdout
|
const response: FileInfo[] = json_response.stdout
|
||||||
.trim()
|
.trim()
|
||||||
@@ -281,7 +282,6 @@ function handle_shell_error(
|
|||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (shell_response.stdout.trim() === '') return true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user