refactored restart and format services to be non-blocking

This commit is contained in:
proddy
2024-08-31 16:12:30 +02:00
parent 382c46622d
commit 931827c526
19 changed files with 243 additions and 202 deletions

View File

@@ -28,7 +28,7 @@ const Help = () => {
const { LL } = useI18nContext();
useLayoutTitle(LL.HELP());
const { send: getAPI } = useRequest((data: APIcall) => API(data), {
const { send: sendAPI } = useRequest((data: APIcall) => API(data), {
immediate: false
}).onSuccess((event) => {
const anchor = document.createElement('a');
@@ -45,8 +45,8 @@ const Help = () => {
toast.info(LL.DOWNLOAD_SUCCESSFUL());
});
const callAPI = async (device: string, entity: string) => {
await getAPI({ device, entity, id: 0 }).catch((error: Error) => {
const callAPI = async (device: string, cmd: string) => {
await sendAPI({ device, cmd, id: 0 }).catch((error: Error) => {
toast.error(error.message);
});
};
@@ -113,7 +113,7 @@ const Help = () => {
color="primary"
onClick={() => callAPI('system', 'allvalues')}
>
{LL.ALLVALUES(0)}
{LL.ALLVALUES()}
</Button>
<Box border={1} p={1} mt={4}>