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
Hide whitespace changes
Inline
Side-by-side
frontend/src/SurveyRouter.tsx
View file @
06176fc6
...
@@ -17,9 +17,9 @@ export const SurveyRouter = () => {
...
@@ -17,9 +17,9 @@ 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
/>
<
Route
path
=
"result"
element
/>
</
Route
>
</
Route
>
<
Route
path
=
"survey"
element
=
{
<
SurveyForm
/>
}
/>
<
Route
path
=
"survey"
element
=
{
<
SurveyForm
/>
}
/>
<
Route
<
Route
...
...
frontend/src/apis/survey.api.ts
View file @
06176fc6
...
@@ -8,11 +8,11 @@ export const createSurvey = async (survey: SurveyType) => {
...
@@ -8,11 +8,11 @@ export const createSurvey = async (survey: SurveyType) => {
};
};
export
const
getSurvey
=
async
(
surveyId
:
string
)
=>
{
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
;
return
data
;
};
};
export
const
getASurvey
=
async
(
surveyId
:
string
)
=>
{
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
;
return
data
;
};
};
//동혁
//동혁
...
@@ -23,13 +23,13 @@ export const getSurveys = async () => {
...
@@ -23,13 +23,13 @@ export const getSurveys = async () => {
export
const
editSurvey
=
async
(
survey
:
SurveyType
)
=>
{
export
const
editSurvey
=
async
(
survey
:
SurveyType
)
=>
{
const
{
data
}
=
await
axios
.
put
(
const
{
data
}
=
await
axios
.
put
(
`
${
baseUrl
}
/surveys/
edit/
${
survey
.
_id
}
`
,
`
${
baseUrl
}
/surveys/
${
survey
.
_id
}
/edit
`
,
survey
survey
);
);
return
data
;
return
data
;
};
};
export
const
deleteSurvey
=
async
(
surveyId
:
string
)
=>
{
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
;
return
data
;
};
};
frontend/src/profile/MySurveyCard.tsx
View file @
06176fc6
...
@@ -15,7 +15,7 @@ export const MySurveyCard = ({ data }: Props) => {
...
@@ -15,7 +15,7 @@ export const MySurveyCard = ({ data }: Props) => {
const
[
success
,
setSuccess
]
=
useState
(
false
);
const
[
success
,
setSuccess
]
=
useState
(
false
);
const
editSurvey
=
()
=>
{
const
editSurvey
=
()
=>
{
navigate
(
`/surveys/
edit/
${
data
.
_id
}
`
,
{
navigate
(
`/surveys/
${
data
.
_id
}
/edit
`
,
{
replace
:
true
,
replace
:
true
,
});
});
};
};
...
...
frontend/src/survey/EditResultButton.tsx
View file @
06176fc6
...
@@ -6,7 +6,7 @@ export const EditResultButton = () => {
...
@@ -6,7 +6,7 @@ export const EditResultButton = () => {
const
navigate
=
useNavigate
();
const
navigate
=
useNavigate
();
function
editButtonClick
(
e
:
React
.
MouseEvent
<
HTMLButtonElement
>
)
{
function
editButtonClick
(
e
:
React
.
MouseEvent
<
HTMLButtonElement
>
)
{
navigate
(
`/surveys/
edit/
${
surveyId
}
`
);
navigate
(
`/surveys/
${
surveyId
}
/edit
`
);
}
}
return
(
return
(
<
div
>
<
div
>
...
...
src/routes/survey.route.ts
View file @
06176fc6
...
@@ -4,15 +4,18 @@ import { authCtrl, surveyCtrl, questionCtrl } from "../controllers";
...
@@ -4,15 +4,18 @@ import { authCtrl, surveyCtrl, questionCtrl } from "../controllers";
const
router
=
express
.
Router
();
const
router
=
express
.
Router
();
router
.
route
(
"
/
"
).
get
(
authCtrl
.
requireLogin
,
surveyCtrl
.
getSurveys
);
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
(
"
/create
"
).
post
(
authCtrl
.
requireLogin
,
surveyCtrl
.
createSurvey
);
router
router
.
route
(
"
/
edit/
:surveyId
"
)
.
route
(
"
/:surveyId
/edit
"
)
.
get
(
authCtrl
.
requireLogin
,
authCtrl
.
authenticate
,
surveyCtrl
.
getSurveyById
)
.
get
(
authCtrl
.
requireLogin
,
authCtrl
.
authenticate
,
surveyCtrl
.
getSurveyById
)
.
put
(
authCtrl
.
requireLogin
,
authCtrl
.
authenticate
,
surveyCtrl
.
updateSurvey
);
.
put
(
authCtrl
.
requireLogin
,
authCtrl
.
authenticate
,
surveyCtrl
.
updateSurvey
);
router
router
.
route
(
"
/
delete/
:surveyId
"
)
.
route
(
"
/:surveyId
/delete
"
)
.
delete
(
.
delete
(
authCtrl
.
requireLogin
,
authCtrl
.
requireLogin
,
authCtrl
.
authenticate
,
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