mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-02 01:05:20 +03:00
improved user experience
This commit is contained in:
parent
3f1a67a03c
commit
4b538d54b9
@ -1,11 +1,9 @@
|
|||||||
import { h, Fragment } from 'preact';
|
import { h, Fragment } from 'preact';
|
||||||
import { useCallback, useEffect, useState } from 'preact/hooks';
|
import { useCallback, useEffect, useState } from 'preact/hooks';
|
||||||
import Dialog from './Dialog';
|
import Dialog from './Dialog';
|
||||||
import { useApiHost } from '../api';
|
|
||||||
import { useRestart } from '../api/mqtt';
|
import { useRestart } from '../api/mqtt';
|
||||||
|
|
||||||
export default function DialogRestart({ show, setShow }) {
|
export default function DialogRestart({ show, setShow }) {
|
||||||
const apiHost = useApiHost();
|
|
||||||
const { payload: detectRestarted = null, send: sendRestart } = useRestart();
|
const { payload: detectRestarted = null, send: sendRestart } = useRestart();
|
||||||
const [dialogTitle, setDialogTitle] = useState('Restart in progress');
|
const [dialogTitle, setDialogTitle] = useState('Restart in progress');
|
||||||
|
|
||||||
@ -22,8 +20,8 @@ export default function DialogRestart({ show, setShow }) {
|
|||||||
await delay(3456);
|
await delay(3456);
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${apiHost}/api/config`, { method: 'GET' });
|
const response = await fetch('/api/config', { method: 'GET' });
|
||||||
if (await response.status == 200)
|
if (await response.status === 200)
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
||||||
catch (e) {}
|
catch (e) {}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user