Commit 2f73640f authored by Kim, Subin's avatar Kim, Subin
Browse files

Private Router 수정중

parent 0254fa6b
......@@ -2,28 +2,31 @@ import { Redirect, Route } from "react-router-dom";
// import { useAuth } from "../context/auth_context";
import ErrorPage from "../pages/ErrorPage";
const PrivateRoute = ({ component, ...rest }) => {
// const { user } = useAuth();
// return (
// <Route
// {...rest}
// render={(props) => {
// if (user) {
// if (rest.role) {
// if (rest.role === user.role) {
// return <Component {...props} />;
// } else {
// return <ErrorPage />
// }
// } else {
// return <Component {...props} />
// }
// } else {
// return <Redirect to="/login" />;
// }
// }}
// />
// );
const PrivateRoute = ({ component: Component, ...rest }) => {
// const { user } = useAuth();
// return (
// <Route
// {...rest}
// render={(props) => {
// if (user) {
// if (rest.role) {
// if (rest.role === user.role) {
// return <Component {...props} />;
// } else {
// return <ErrorPage />
// }
// } else {
// return <Component {...props} />
// }
// } else {
// return <Redirect to="/login" />;
// }
// }}
// />
// );
return (
<Route {...rest} render={(props) => <Component {...props} />} />
)
};
export default PrivateRoute;
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment