feat: update

This commit is contained in:
landaiqing
2024-07-22 09:04:46 +08:00
parent 3dacedf7fd
commit ac41e00105
26 changed files with 1424 additions and 965 deletions

View File

@@ -1,9 +1,9 @@
/** @format */
import matchAuth from "./matchRouter.ts";
import { Navigate, useLocation } from "react-router-dom";
// import { message } from "antd";
import { getStorageFromKey } from "@/utils/localStorage/config.ts";
import React from "react";
import { message } from "antd";
export default function AuthRoute(props: { children: React.ReactNode }) {
const location: any = useLocation();
const isLogin = getStorageFromKey("token");
@@ -32,14 +32,14 @@ export default function AuthRoute(props: { children: React.ReactNode }) {
return <Navigate to="/404" />;
}
// if (!isLogin) {
// message
// .open({
// content: "请先登录!",
// type: "warning",
// })
// .then();
// return <Navigate to="/login" />;
// }
if (!isLogin) {
message
.open({
content: "请先登录!",
type: "warning",
})
.then();
return <Navigate to="/login" />;
}
return props.children;
}