Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/favicon.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
Expand All @@ -27,7 +27,7 @@
<title>PIROIN</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<noscript>피로그래밍 운영을 위한 통합 플랫폼</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
Expand Down
8 changes: 4 additions & 4 deletions frontend/public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"short_name": "PIROIN",
"name": "PIROIN",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"src": "favicon.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"src": "favicon.png",
"type": "image/png",
"sizes": "512x512"
}
Expand Down
36 changes: 21 additions & 15 deletions frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import Assignment from './pages/pirocheck/assignment/Assignment';
import Deposit from './pages/pirocheck/deposit/Deposit';
import StudentList from './pages/pirocheck/students/StudentList';
import StudentDetail from './pages/pirocheck/students/StudentDetail';
import ProtectedRoute from "./routes/ProtectedRoute";

function App() {
return (
Expand All @@ -23,22 +24,27 @@ function App() {
<Route path="/login" element={<LoginPage />} />
<Route path="/onboarding" element={<OnboardingPage />} />

{/* 라이트 헤더 페이지 */}
<Route element={<Layout headerType="light" />}>
<Route path="/sessions" element={<QnAMainPage />} />
<Route path="/sessions/:sessionId/questions" element={<QnAListPage />} />
<Route path="/sessions/:sessionId/questions/:questionId" element={<QnADetailPage />} />
<Route path="/curriculum" element={<CurriculumPage />} />
</Route>
{/* 로그인 필요한 페이지들 */}
<Route element={<ProtectedRoute />}>

{/* 라이트 헤더 페이지 */}
<Route element={<Layout headerType="light" />}>
<Route path="/sessions" element={<QnAMainPage />} />
<Route path="/sessions/:sessionId/questions" element={<QnAListPage />} />
<Route path="/sessions/:sessionId/questions/:questionId" element={<QnADetailPage />} />
<Route path="/curriculum" element={<CurriculumPage />} />
</Route>

{/* 다크 헤더 페이지 */}
<Route element={<Layout headerType="dark" />}>
<Route path="/pirocheck" element={<PiroCheckMain />} />
<Route path="/pirocheck/attendance" element={<Attendance />} />
<Route path="/pirocheck/assignment" element={<Assignment />} />
<Route path="/pirocheck/deposit" element={<Deposit />} />
<Route path="/pirocheck/students" element={<StudentList />} />
<Route path="/pirocheck/students/:userId" element={<StudentDetail />} />
</Route>

{/* 다크 헤더 페이지 */}
<Route element={<Layout headerType="dark" />}>
<Route path="/pirocheck" element={<PiroCheckMain />} />
<Route path="/pirocheck/attendance" element={<Attendance />} />
<Route path="/pirocheck/assignment" element={<Assignment />} />
<Route path="/pirocheck/deposit" element={<Deposit />} />
<Route path="/pirocheck/students" element={<StudentList />} />
<Route path="/pirocheck/students/:userId" element={<StudentDetail />} />
</Route>

</Routes>
Expand Down
11 changes: 11 additions & 0 deletions frontend/src/routes/ProtectedRoute.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Navigate, Outlet } from "react-router-dom";

export default function ProtectedRoute() {
const token = localStorage.getItem("token");

if (!token) {
return <Navigate to="/login" replace />;
}

return <Outlet />;
}
Loading