improved user experience

This commit is contained in:
ElMoribond 2021-07-13 11:17:03 +02:00 committed by GitHub
parent 4b538d54b9
commit dc732f192c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,11 +13,12 @@ export default function DialogRestart({ show, setShow }) {
setDialogTitle('Server-initiated startup');
setShow(false);
}
}, [detectRestarted]);
}, [detectRestarted]); // eslint-disable-line react-hooks/exhaustive-deps
const waitPlease = async () => {
const delay = ms => new Promise(res => setTimeout(res, ms));
await delay(3456);
/* eslint-disable no-constant-condition */
while (true) {
try {
const response = await fetch('/api/config', { method: 'GET' });
@ -33,11 +34,11 @@ export default function DialogRestart({ show, setShow }) {
sendRestart();
setShow(false);
waitPlease();
});
}, [show]); // eslint-disable-line react-hooks/exhaustive-deps
const handleDismiss = useCallback(() => {
setShow(false);
});
}, [show]); // eslint-disable-line react-hooks/exhaustive-deps
return (
<Fragment>