微信小程序页面迁移校验之前 P5任务处理之前
This commit is contained in:
@@ -21,6 +21,7 @@ import {
|
||||
} from "@ant-design/icons";
|
||||
import type { MenuProps } from "antd";
|
||||
import { useAuthStore } from "./store/authStore";
|
||||
import { useBusinessDayStore } from "./store/businessDayStore";
|
||||
import { fetchQueue } from "./api/execution";
|
||||
import type { QueuedTask } from "./types";
|
||||
import Login from "./pages/Login";
|
||||
@@ -179,12 +180,15 @@ const AppLayout: React.FC = () => {
|
||||
|
||||
const App: React.FC = () => {
|
||||
const hydrate = useAuthStore((s) => s.hydrate);
|
||||
const initBusinessDay = useBusinessDayStore((s) => s.init);
|
||||
const [hydrated, setHydrated] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
hydrate();
|
||||
setHydrated(true);
|
||||
}, [hydrate]);
|
||||
// 启动时请求一次营业日配置,降级策略在 store 内部处理
|
||||
initBusinessDay();
|
||||
}, [hydrate, initBusinessDay]);
|
||||
|
||||
/* hydrate 完成前不渲染路由,避免 PrivateRoute 误判跳转到 /login */
|
||||
if (!hydrated) return <Spin style={{ display: "flex", justifyContent: "center", marginTop: 120 }} />;
|
||||
|
||||
Reference in New Issue
Block a user