This commit is contained in:
2024-02-25 08:27:01 +08:00
commit 20c1fa08dc
279 changed files with 78489 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
import React from "react";
import Auth from "./Auth";
import { Route, Redirect } from "react-router-dom";
function AuthRoute({ children, ...rest }) {
return (
<Route
{...rest}
render={({ location }) =>
Auth.Check(rest.isLogin) ? (
children
) : (
<Redirect
to={{
pathname: "/login",
state: { from: location },
}}
/>
)
}
/>
);
}
export default AuthRoute;