SurveyRouter.tsx 1.62 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 { AnswerSurveyForm } from "./answers";
7
import { Home } from "./home";
8
import { Profile } from "./profile";
9
import { EditResultButton } from "./survey";
10
import { EditSurvey } from "./survey/EditSurvey";
jang dong hyeok's avatar
.    
jang dong hyeok committed
11
import { ResultSurvey } from "./survey/ResultSurvey";
Lee SeoYeon's avatar
Lee SeoYeon committed
12
13
import { CompleteSurvey } from "./survey/CompleteSurvey";
import { SameSurvey } from "./survey/SameSurvey";
Lee SeoYeon's avatar
Lee SeoYeon committed
14
import { CreateSurvey } from "./survey/CreateSurvey";
15
16
17
18
19
20
21
22
23

export const SurveyRouter = () => {
  return (
    <BrowserRouter>
      <Routes>
        <Route path="/" element={<App />}>
          <Route index element={<Home />} />
          <Route path="login" element={<Login />} />
          <Route path="signup" element={<SignUp />} />
Lee SeoYeon's avatar
Lee SeoYeon committed
24
          <Route path="surveys/:surveyId/create" element={<CreateSurvey />} />
Lee SeoYeon's avatar
Lee SeoYeon committed
25
26
27
          <Route path="surveys/:surveyId/" element={<EditResultButton />}>
            <Route path="edit" element={<EditSurvey />} />
            <Route path="result" element={<ResultSurvey />} />
28
          </Route>
Lee SeoYeon's avatar
Lee SeoYeon committed
29
30
31
          <Route path="survey/:surveyId" element={<AnswerSurveyForm />} />
          <Route path="survey/complete" element={<CompleteSurvey />} />
          <Route path="survey/same" element={<SameSurvey />} />
32
33
34
35
36
37
38
39
          <Route
            path="profile"
            element={
              <RequireAuth>
                <Profile />
              </RequireAuth>
            }
          />
40
41
42
43
44
        </Route>
      </Routes>
    </BrowserRouter>
  );
};