Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
survey
Commits
06176fc6
Commit
06176fc6
authored
Jul 20, 2022
by
jang dong hyeok
Browse files
route 변경
parent
f3c4f117
Changes
5
Show whitespace changes
Inline
Side-by-side
frontend/src/SurveyRouter.tsx
View file @
06176fc6
...
...
@@ -17,9 +17,9 @@ export const SurveyRouter = () => {
<
Route
index
element
=
{
<
Home
/>
}
/>
<
Route
path
=
"login"
element
=
{
<
Login
/>
}
/>
<
Route
path
=
"signup"
element
=
{
<
SignUp
/>
}
/>
<
Route
path
=
"surveys/
edit
/"
element
=
{
<
EditResultButton
/>
}
>
<
Route
path
=
"
:surveyId
"
element
=
{
<
EditSurvey
/>
}
/>
<
Route
path
=
"
:surveyId/
result"
element
/>
<
Route
path
=
"surveys/
:surveyId
/"
element
=
{
<
EditResultButton
/>
}
>
<
Route
path
=
"
edit
"
element
=
{
<
EditSurvey
/>
}
/>
<
Route
path
=
"result"
element
/>
</
Route
>
<
Route
path
=
"survey"
element
=
{
<
SurveyForm
/>
}
/>
<
Route
...
...
frontend/src/apis/survey.api.ts
View file @
06176fc6
...
...
@@ -8,11 +8,11 @@ export const createSurvey = async (survey: SurveyType) => {
};
export
const
getSurvey
=
async
(
surveyId
:
string
)
=>
{
const
{
data
}
=
await
axios
.
get
(
`
${
baseUrl
}
/surveys/
edit/
${
surveyId
}
`
);
const
{
data
}
=
await
axios
.
get
(
`
${
baseUrl
}
/surveys/
${
surveyId
}
/edit
`
);
return
data
;
};
export
const
getASurvey
=
async
(
surveyId
:
string
)
=>
{
const
{
data
}
=
await
axios
.
get
(
`
${
baseUrl
}
/surveys/
edit/
${
surveyId
}
`
);
const
{
data
}
=
await
axios
.
get
(
`
${
baseUrl
}
/surveys/
${
surveyId
}
/edit
`
);
return
data
;
};
//동혁
...
...
@@ -23,13 +23,13 @@ export const getSurveys = async () => {
export
const
editSurvey
=
async
(
survey
:
SurveyType
)
=>
{
const
{
data
}
=
await
axios
.
put
(
`
${
baseUrl
}
/surveys/
edit/
${
survey
.
_id
}
`
,
`
${
baseUrl
}
/surveys/
${
survey
.
_id
}
/edit
`
,
survey
);
return
data
;
};
export
const
deleteSurvey
=
async
(
surveyId
:
string
)
=>
{
const
{
data
}
=
await
axios
.
delete
(
`
${
baseUrl
}
/surveys/
delete/
${
surveyId
}
`
);
const
{
data
}
=
await
axios
.
delete
(
`
${
baseUrl
}
/surveys/
${
surveyId
}
/delete
`
);
return
data
;
};
frontend/src/profile/MySurveyCard.tsx
View file @
06176fc6
...
...
@@ -15,7 +15,7 @@ export const MySurveyCard = ({ data }: Props) => {
const
[
success
,
setSuccess
]
=
useState
(
false
);
const
editSurvey
=
()
=>
{
navigate
(
`/surveys/
edit/
${
data
.
_id
}
`
,
{
navigate
(
`/surveys/
${
data
.
_id
}
/edit
`
,
{
replace
:
true
,
});
};
...
...
frontend/src/survey/EditResultButton.tsx
View file @
06176fc6
...
...
@@ -6,7 +6,7 @@ export const EditResultButton = () => {
const
navigate
=
useNavigate
();
function
editButtonClick
(
e
:
React
.
MouseEvent
<
HTMLButtonElement
>
)
{
navigate
(
`/surveys/
edit/
${
surveyId
}
`
);
navigate
(
`/surveys/
${
surveyId
}
/edit
`
);
}
return
(
<
div
>
...
...
src/routes/survey.route.ts
View file @
06176fc6
...
...
@@ -4,15 +4,18 @@ import { authCtrl, surveyCtrl, questionCtrl } from "../controllers";
const
router
=
express
.
Router
();
router
.
route
(
"
/
"
).
get
(
authCtrl
.
requireLogin
,
surveyCtrl
.
getSurveys
);
router
.
route
(
"
/:surveyId
"
).
get
(
surveyCtrl
.
getSurveyById
);
router
.
route
(
"
/:surveyId
"
)
.
get
(
surveyCtrl
.
getSurveyById
);
router
.
route
(
"
/create
"
).
post
(
authCtrl
.
requireLogin
,
surveyCtrl
.
createSurvey
);
router
.
route
(
"
/
edit/
:surveyId
"
)
.
route
(
"
/:surveyId
/edit
"
)
.
get
(
authCtrl
.
requireLogin
,
authCtrl
.
authenticate
,
surveyCtrl
.
getSurveyById
)
.
put
(
authCtrl
.
requireLogin
,
authCtrl
.
authenticate
,
surveyCtrl
.
updateSurvey
);
router
.
route
(
"
/
delete/
:surveyId
"
)
.
route
(
"
/:surveyId
/delete
"
)
.
delete
(
authCtrl
.
requireLogin
,
authCtrl
.
authenticate
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment