SurveyRouter.tsx 1018 Bytes
Newer Older
1
2
3
4
import React from "react";
import { BrowserRouter, Route, Routes } from "react-router-dom";
import App from "./App";
import { Login, SignUp } from "./auth";
5
import { RequireAuth } from "./auth/RequireAuth";
6
import { SurveyForm } from "./commons";
7
import { Home } from "./home";
8
import { Profile } from "./profile";
Jiwon Yoon's avatar
Jiwon Yoon committed
9
import { EditSurvey } from "./survey";
10
11
12
13
14
15
16
17
18

export const SurveyRouter = () => {
  return (
    <BrowserRouter>
      <Routes>
        <Route path="/" element={<App />}>
          <Route index element={<Home />} />
          <Route path="login" element={<Login />} />
          <Route path="signup" element={<SignUp />} />
Jiwon Yoon's avatar
Jiwon Yoon committed
19
          <Route path="surveys/edit/:surveyId" element={<EditSurvey />} />
20
          <Route path="surveys/:surveyId" element={<SurveyForm />} />
21
22
23
24
25
26
27
28
          <Route
            path="profile"
            element={
              <RequireAuth>
                <Profile />
              </RequireAuth>
            }
          />
29
30
31
32
33
        </Route>
      </Routes>
    </BrowserRouter>
  );
};