feat: update
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user