diff --git a/frontend/src/context/AuthContext.jsx b/frontend/src/context/AuthContext.jsx index b87ca93..13c9c2e 100644 --- a/frontend/src/context/AuthContext.jsx +++ b/frontend/src/context/AuthContext.jsx @@ -49,6 +49,8 @@ export function AuthProvider({ children }) { }; useEffect(() => { + + console.log(systemStatus); systemStatus === 1 && token && getUserInfoFromToken(); if (systemStatus === 0) { @@ -64,7 +66,7 @@ export function AuthProvider({ children }) { }, []) return ( - + {children} ); diff --git a/frontend/src/pages/InitPage.jsx b/frontend/src/pages/InitPage.jsx index 7c33d50..8d38a73 100644 --- a/frontend/src/pages/InitPage.jsx +++ b/frontend/src/pages/InitPage.jsx @@ -6,7 +6,7 @@ import { useAuth } from "../context/AuthContext"; import { useEffect } from "react"; const rules = [{required: true}] const InitPage = () => { - const { systemStatus } = useAuth(); + const { systemStatus, setSystemStatus } = useAuth(); const navigate = useNavigate(); const { message } = App.useApp(); useEffect(() => { @@ -21,7 +21,7 @@ const InitPage = () => { const res = await initSystem(values); if (res?.success) { message.success("初始化成功"); - navigate("/login"); + setSystemStatus(1); } else { message.error(res.message); }