App.js 894 Bytes
Newer Older
1
import { BrowserRouter as Router, Route, Switch } from "react-router-dom";
Kim, Subin's avatar
Kim, Subin committed
2
3
4
5
6
7
import HomePage from "./pages/HomePage";
import SchedulePage from "./pages/SchedulePage";
import ScheduleEditPage from "./pages/ScheduleEditPage";
import AdminPage from "./pages/AdminPage";
import PrivateRoute from "./components/PrivateRoute";
import Err from "./pages/ErrorPage";
Kim, Subin's avatar
Kim, Subin committed
8
9
10

function App() {
  return (
Kim, Subin's avatar
Kim, Subin committed
11
    <Router basename={process.env.PUBLIC_URL}>
Kim, Subin's avatar
Kim, Subin committed
12
13
14
      <div className="mx-auto" style={{ width: "400px" }}>
        <Switch>
          <Route exact path="/" component={Err} />
Kim, Subin's avatar
Kim, Subin committed
15
16
17
          <Route path="/home" component={HomePage} />
          <Route path="/schedule/edit" component={ScheduleEditPage} />
          <Route path="/schedule" component={SchedulePage} />
Kim, Subin's avatar
Kim, Subin committed
18
19
20
          <PrivateRoute path="/admin" component={AdminPage} role="admin" />
        </Switch>
      </div>
Kim, Subin's avatar
Kim, Subin committed
21
    </Router>
Kim, Subin's avatar
Kim, Subin committed
22
23
24
  );
}

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