import { Redirect, Route } from "react-router-dom"; import authApi from "../apis/auth.api.js"; import { useAuth } from "../context/auth_context"; import ErrorPage from "../pages/ErrorPage"; const PrivateRoute = ({ component: Component, ...rest }) => { return ( { if (user.id) { if (rest.role) { if (rest.role === user.role) { return ; } else { return } } else { return } } else { alert("로그인이 필요한 기능입니다.") return ; } }} /> ); }; export default PrivateRoute