Commit 32ed197b authored by Lee SeoYeon's avatar Lee SeoYeon
Browse files

라우터 설정

parent 9cbfffe1
...@@ -9,6 +9,8 @@ import { Profile } from "./profile"; ...@@ -9,6 +9,8 @@ import { Profile } from "./profile";
import { EditResultButton } from "./survey"; import { EditResultButton } from "./survey";
import { EditSurvey } from "./survey/EditSurvey"; import { EditSurvey } from "./survey/EditSurvey";
import { ResultSurvey } from "./survey/ResultSurvey"; import { ResultSurvey } from "./survey/ResultSurvey";
import { CompleteSurvey } from "./survey/CompleteSurvey";
import { SameSurvey } from "./survey/SameSurvey";
export const SurveyRouter = () => { export const SurveyRouter = () => {
return ( return (
...@@ -18,11 +20,13 @@ export const SurveyRouter = () => { ...@@ -18,11 +20,13 @@ export const SurveyRouter = () => {
<Route index element={<Home />} /> <Route index element={<Home />} />
<Route path="login" element={<Login />} /> <Route path="login" element={<Login />} />
<Route path="signup" element={<SignUp />} /> <Route path="signup" element={<SignUp />} />
<Route path="surveys/edit/" element={<EditResultButton />}> <Route path="surveys/:surveyId/" element={<EditResultButton />}>
<Route path=":surveyId" element={<EditSurvey />} /> <Route path="edit" element={<EditSurvey />} />
<Route path=":surveyId/result" element={<ResultSurvey />} /> <Route path="result" element={<ResultSurvey />} />
</Route> </Route>
<Route path="surveys/:surveyId" element={<AnswerSurveyForm />} /> <Route path="survey/:surveyId" element={<AnswerSurveyForm />} />
<Route path="survey/complete" element={<CompleteSurvey />} />
<Route path="survey/same" element={<SameSurvey />} />
<Route <Route
path="profile" path="profile"
element={ element={
......
...@@ -39,8 +39,7 @@ export const AnswerSurveyForm = () => { ...@@ -39,8 +39,7 @@ export const AnswerSurveyForm = () => {
if (isSurvey) { if (isSurvey) {
console.log("object", isSurvey); console.log("object", isSurvey);
alert("제출한 설문조사입니다"); navigate("/survey/same");
navigate("/");
} }
const addFiles = (oneFile: { questionId: string; file: File }) => { const addFiles = (oneFile: { questionId: string; file: File }) => {
...@@ -93,7 +92,7 @@ export const AnswerSurveyForm = () => { ...@@ -93,7 +92,7 @@ export const AnswerSurveyForm = () => {
const newAnswer: AnswerType = await answerApi.saveAnswers(formData); const newAnswer: AnswerType = await answerApi.saveAnswers(formData);
console.log(newAnswer); console.log(newAnswer);
localStorage.setItem(`survey_${surveyId}`, surveyId ?? ""); localStorage.setItem(`survey_${surveyId}`, surveyId ?? "");
alert("제출되었습니다"); navigate("/survey/complete");
setSuccess(true); setSuccess(true);
setError(""); setError("");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment