From 4b538d54b9d0d9060b3036d4f3253102773ef332 Mon Sep 17 00:00:00 2001 From: ElMoribond Date: Tue, 13 Jul 2021 10:37:32 +0200 Subject: [PATCH] improved user experience --- web/src/components/DialogRestart.jsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/web/src/components/DialogRestart.jsx b/web/src/components/DialogRestart.jsx index 08ec81ff5..4f351c1fb 100644 --- a/web/src/components/DialogRestart.jsx +++ b/web/src/components/DialogRestart.jsx @@ -1,11 +1,9 @@ import { h, Fragment } from 'preact'; import { useCallback, useEffect, useState } from 'preact/hooks'; import Dialog from './Dialog'; -import { useApiHost } from '../api'; import { useRestart } from '../api/mqtt'; export default function DialogRestart({ show, setShow }) { - const apiHost = useApiHost(); const { payload: detectRestarted = null, send: sendRestart } = useRestart(); const [dialogTitle, setDialogTitle] = useState('Restart in progress'); @@ -22,8 +20,8 @@ export default function DialogRestart({ show, setShow }) { await delay(3456); while (true) { try { - const response = await fetch(`${apiHost}/api/config`, { method: 'GET' }); - if (await response.status == 200) + const response = await fetch('/api/config', { method: 'GET' }); + if (await response.status === 200) window.location.reload(); } catch (e) {}