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";
...
@@ -2,28 +2,31 @@ import { Redirect, Route } from "react-router-dom";
// import { useAuth } from "../context/auth_context";
// import { useAuth } from "../context/auth_context";
import
ErrorPage
from
"
../pages/ErrorPage
"
;
import
ErrorPage
from
"
../pages/ErrorPage
"
;
const
PrivateRoute
=
({
component
,
...
rest
})
=>
{
const
PrivateRoute
=
({
component
:
Component
,
...
rest
})
=>
{
// const { user } = useAuth();
// const { user } = useAuth();
// return (
// return (
// <Route
// <Route
// {...rest}
// {...rest}
// render={(props) => {
// render={(props) => {
// if (user) {
// if (user) {
// if (rest.role) {
// if (rest.role) {
// if (rest.role === user.role) {
// if (rest.role === user.role) {
// return <Component {...props} />;
// return <Component {...props} />;
// } else {
// } else {
// return <ErrorPage />
// return <ErrorPage />
// }
// }
// } else {
// } else {
// return <Component {...props} />
// return <Component {...props} />
// }
// }
// } else {
// } else {
// return <Redirect to="/login" />;
// return <Redirect to="/login" />;
// }
// }
// }}
// }}
// />
// />
// );
// );
return
(
<
Route
{...
rest
}
render
=
{(
props
)
=>
<
Component
{...
props
}
/>} /
>
)
};
};
export
default
PrivateRoute
;
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