Commit dfd1731e authored by jang dong hyeok's avatar jang dong hyeok
Browse files

수정페이지 UI 및 route 연결

parent 8b8c6f9c
......@@ -6,7 +6,8 @@ import { RequireAuth } from "./auth/RequireAuth";
import { SurveyForm } from "./commons";
import { Home } from "./home";
import { Profile } from "./profile";
import { EditSurvey } from "./survey";
import { EditResponseButton } from "./survey";
import { EditSurvey } from "./survey/EditSurvey";
export const SurveyRouter = () => {
return (
......@@ -16,7 +17,10 @@ export const SurveyRouter = () => {
<Route index element={<Home />} />
<Route path="login" element={<Login />} />
<Route path="signup" element={<SignUp />} />
<Route path="surveys/edit/:surveyId" element={<EditSurvey />} />
<Route path="surveys/edit/" element={<EditResponseButton />}>
<Route path=":surveyId" element={<EditSurvey />} />
<Route path=":surveyId/response" element />
</Route>
<Route path="survey" element={<SurveyForm />} />
<Route
path="profile"
......
import React from "react";
import { Outlet, useNavigate, useParams } from "react-router-dom";
export const EditResponseButton = () => {
let { surveyId } = useParams<{ surveyId: string }>();
const navigate = useNavigate();
function editButtonClick(e: React.MouseEvent<HTMLButtonElement>) {
navigate(`/surveys/edit/${surveyId}`);
}
return (
<div>
<div className="flex place-content-center">
<button
className="text-xl m-3 underline decoration-4"
onClick={editButtonClick}
>
설문지 수정
</button>
<button
className="text-xl m-3 underline"
/*onClick={}*/
>
응답결과
</button>
</div>
<Outlet />
</div>
);
};
export { EditSurvey } from "./EditSurvey";
export { EditResponseButton } from "./EditResponseButton";
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