alova - refactor wifi scan

This commit is contained in:
Proddy
2023-06-18 10:46:50 +02:00
parent ed55a96b80
commit b1d666d7b9
14 changed files with 58 additions and 60 deletions

View File

@@ -12,7 +12,7 @@ import { useI18nContext } from 'i18n/i18n-react';
import * as EMSESP from 'project/api';
interface UploadFileProps {
// TODO fileupload upload move to alova
// TODO fileupload move to alova
uploadGeneralFile: (file: File, config?: FileUploadConfig) => AxiosPromise<void>;
}

View File

@@ -8,7 +8,6 @@ import { FormLoader } from 'components';
import { useI18nContext } from 'i18n/i18n-react';
const RESTART_TIMEOUT = 2 * 60 * 1000;
const POLL_TIMEOUT = 2000;
const POLL_INTERVAL = 5000;
const RestartMonitor: FC = () => {
@@ -17,14 +16,15 @@ const RestartMonitor: FC = () => {
const { LL } = useI18nContext();
const { send: readSystemStatus } = useRequest((timeout) => SystemApi.readSystemStatus(timeout), {
const { send: readSystemStatus } = useRequest(SystemApi.readSystemStatus(), {
force: true,
immediate: false
});
const timeoutAt = useRef(new Date().getTime() + RESTART_TIMEOUT);
const poll = useRef(async () => {
try {
await readSystemStatus(POLL_TIMEOUT);
await readSystemStatus();
document.location.href = '/fileUpdated';
} catch (error) {
if (new Date().getTime() < timeoutAt.current) {

View File

@@ -73,7 +73,7 @@ const SystemStatusForm: FC = () => {
immediate: false
});
const { data: data, send: loadData, error } = useRequest(SystemApi.readSystemStatus);
const { data: data, send: loadData, error } = useRequest(SystemApi.readSystemStatus, { force: true });
useEffect(() => {
void axios.get(VERSIONCHECK_ENDPOINT).then((response) => {