Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
Today KU
Commits
2f73640f
Commit
2f73640f
authored
Oct 07, 2021
by
Kim, Subin
Browse files
Private Router 수정중
parent
0254fa6b
Changes
1
Hide whitespace changes
Inline
Side-by-side
client/src/components/PrivateRoute.js
View file @
2f73640f
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment