mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-09 17:29:50 +03:00
make it work from web (thanks michael)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { type FC, useEffect, useRef, useState } from 'react';
|
||||
|
||||
import * as SystemApi from 'api/system';
|
||||
|
||||
@@ -6,10 +6,14 @@ import { useRequest } from 'alova/client';
|
||||
import { FormLoader } from 'components';
|
||||
import { useI18nContext } from 'i18n/i18n-react';
|
||||
|
||||
const RESTART_TIMEOUT = 2 * 60 * 1000;
|
||||
const POLL_INTERVAL = 1000;
|
||||
const RESTART_TIMEOUT = 2 * 60 * 1000; // 2 minutes
|
||||
const POLL_INTERVAL = 1000; // every 1 second
|
||||
|
||||
const RestartMonitor = () => {
|
||||
export interface RestartMonitorProps {
|
||||
message?: string;
|
||||
}
|
||||
|
||||
const RestartMonitor: FC<RestartMonitorProps> = ({ message }) => {
|
||||
const [failed, setFailed] = useState<boolean>(false);
|
||||
const [timeoutId, setTimeoutId] = useState<NodeJS.Timeout>();
|
||||
const { LL } = useI18nContext();
|
||||
@@ -38,7 +42,7 @@ const RestartMonitor = () => {
|
||||
|
||||
return (
|
||||
<FormLoader
|
||||
message={LL.APPLICATION_RESTARTING() + '...'}
|
||||
message={message ? message : LL.APPLICATION_RESTARTING() + '...'}
|
||||
errorMessage={failed ? 'Timed out' : undefined}
|
||||
/>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user