App.js 2.27 KB
Newer Older
1
import { BrowserRouter as Router, Route, Switch } from "react-router-dom";
Kim, Subin's avatar
Kim, Subin committed
2
3
import LoginPage from "./pages/LoginPage";
import SignupPage from "./pages/SignupPage";
Kim, Subin's avatar
Kim, Subin committed
4
5
6
import HomePage from "./pages/HomePage";
import SchedulePage from "./pages/SchedulePage";
import ScheduleEditPage from "./pages/ScheduleEditPage";
7
8
9
10
11
import ToDoPage from "./pages/ToDoPage";
import StudyPlanListPage from "./pages/StudyPlanListPage";
import StudyPlanPage from "./pages/StudyPlanPage";
import StudyPlanEditPage from "./pages/StudyPlanEditPage";
import SubjectEditPage from "./pages/SubjectEditPage";
Kim, Subin's avatar
Kim, Subin committed
12
import AdminPage from "./pages/Admin/AdminPage";
13
import { AuthProvider } from "./utils/context.js";
Kim, Subin's avatar
Kim, Subin committed
14
import PrivateRoute from "./components/PrivateRoute";
Kim, Subin's avatar
Kim, Subin committed
15
import ErrorPage from "./pages/ErrorPage";
Kim, Subin's avatar
Kim, Subin committed
16
17
18

function App() {
  return (
19
20
21
22
23
24
25
26
27
28
29
    <AuthProvider >
      <Router basename={process.env.PUBLIC_URL}>
        <div id="box" className="container position-relative vh-100 mx-sm-auto">
          <Switch>
            <Route exact path="/" component={LoginPage} />
            <Route path="/login" component={LoginPage} />
            <Route path="/signup" component={SignupPage} />
            <Route path="/home" component={HomePage} />
            <Route path="/schedule/edit" component={ScheduleEditPage} />
            <Route path="/schedule/:date" component={SchedulePage} />
            <Route path="/todo/:date" component={ToDoPage} />
Choi Ga Young's avatar
Choi Ga Young committed
30
31
32
            <Route path="/studyplan/edit/add/:subjectId" component={StudyPlanEditPage} />
            <Route path="/studyplan/edit/:planId" component={StudyPlanEditPage} />
            <Route path="/studyplan/:subjectId" component={StudyPlanPage} />
33
34
35
            <Route path="/studyplan" component={StudyPlanListPage} />
            <Route path="/subject/edit/:subjectId" component={SubjectEditPage} />
            <Route path="/subject/edit" component={SubjectEditPage} />
36
            <Route path="/admin/edit/:scheduleId" component={ScheduleEditPage} />
37
38
39
            <Route path="/admin/edit" component={ScheduleEditPage} />
            <Route path="/admin" component={AdminPage} />
            {/* <PrivateRoute path="/admin" component={AdminPage} role="admin" /> */}
Kim, Subin's avatar
Kim, Subin committed
40

41
42
43
44
45
            <Route component={ErrorPage} />
          </Switch>
        </div>
      </Router>
    </AuthProvider>
Kim, Subin's avatar
Kim, Subin committed
46
47
48
  );
}

Kim, Subin's avatar
Kim, Subin committed
49
export default App;