修改初始系统状态逻辑已经错误页面

This commit is contained in:
whyour
2023-05-07 23:40:37 +08:00
parent 481646501c
commit f66390eabd
6 changed files with 69 additions and 24 deletions
+19 -6
View File
@@ -98,8 +98,7 @@ export default function () {
})
.catch((error) => {
console.log(error);
})
.finally(() => setInitLoading(false));
});
};
const getUser = (needLoading = true) => {
@@ -120,6 +119,22 @@ export default function () {
});
};
const getHealthStatus = () => {
request
.get(`${config.apiPrefix}public/health`)
.then((res) => {
if (res?.data?.status === 1) {
getSystemInfo();
} else {
history.push('/error');
}
})
.catch((error) => {
history.push('/error');
})
.finally(() => setInitLoading(false));
};
const reloadUser = (needLoading = false) => {
getUser(needLoading);
};
@@ -131,10 +146,8 @@ export default function () {
}, [location.pathname]);
useEffect(() => {
if (!systemInfo) {
getSystemInfo();
}
}, [systemInfo]);
getHealthStatus();
}, []);
useEffect(() => {
if (theme === 'vs-dark') {