App.js 2.08 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
30
31
32
33
34
35
36
37
    <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} />
            <Route path="/studyplan/edit" component={StudyPlanEditPage} />
            <Route path="/studyplan/:" component={StudyPlanPage} />
            <Route path="/studyplan" component={StudyPlanListPage} />
            <Route path="/subject/edit/:subjectId" component={SubjectEditPage} />
            <Route path="/subject/edit" component={SubjectEditPage} />
            <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
38

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

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