SurveyRouter.tsx 1.18 KB
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";
9
10
import { EditResponseButton } from "./survey";
import { EditSurvey } from "./survey/EditSurvey";
11
12
13
14
15
16
17
18
19

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