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
72d4eb09
Commit
72d4eb09
authored
Jul 22, 2022
by
jang dong hyeok
Browse files
.
parent
1f7641e8
Changes
7
Show whitespace changes
Inline
Side-by-side
frontend/src/SurveyRouter.tsx
View file @
72d4eb09
...
...
@@ -8,6 +8,7 @@ import { Home } from "./home";
import
{
Profile
}
from
"
./profile
"
;
import
{
EditResultButton
}
from
"
./survey
"
;
import
{
EditSurvey
}
from
"
./survey/EditSurvey
"
;
import
{
ResultSurvey
}
from
"
./survey/ResultSurvey
"
;
export
const
SurveyRouter
=
()
=>
{
return
(
...
...
@@ -19,7 +20,7 @@ export const SurveyRouter = () => {
<
Route
path
=
"signup"
element
=
{
<
SignUp
/>
}
/>
<
Route
path
=
"surveys/:surveyId/"
element
=
{
<
EditResultButton
/>
}
>
<
Route
path
=
"edit"
element
=
{
<
EditSurvey
/>
}
/>
<
Route
path
=
"result"
element
/>
<
Route
path
=
"result"
element
=
{
<
ResultSurvey
/>
}
/>
</
Route
>
<
Route
path
=
"survey"
element
=
{
<
SurveyForm
/>
}
/>
<
Route
...
...
frontend/src/apis/survey.api.ts
View file @
72d4eb09
...
...
@@ -30,6 +30,13 @@ export const editSurvey = async (survey: SurveyType) => {
);
return
data
;
};
export
const
resultSurvey
=
async
(
survey
:
SurveyType
)
=>
{
const
{
data
}
=
await
axios
.
put
(
`
${
baseUrl
}
/surveys/
${
survey
.
_id
}
/result`
,
survey
);
return
data
;
};
export
const
deleteSurvey
=
async
(
surveyId
:
string
)
=>
{
const
{
data
}
=
await
axios
.
delete
(
`
${
baseUrl
}
/surveys/
${
surveyId
}
/delete`
);
...
...
frontend/src/profile/MySurveyCard.tsx
View file @
72d4eb09
...
...
@@ -64,13 +64,6 @@ export const MySurveyCard = ({ data }: Props) => {
</
div
>
</
button
>
<
div
className
=
"flex justify-end pt-1"
>
{
/*<button
type="button"
className="bg-themeColor rounded text-white py-1 px-1.5 mr-1"
onClick={editSurvey}
>
수정
</button>*/
}
<
button
type
=
"button"
className
=
"bg-themeColor rounded text-white py-1 px-1.5 ml-1"
...
...
frontend/src/survey/EditResultButton.tsx
View file @
72d4eb09
import
React
from
"
react
"
;
import
{
NavLink
}
from
"
react-router-dom
"
;
import
{
Outlet
,
useNavigate
,
useParams
}
from
"
react-router-dom
"
;
export
const
EditResultButton
=
()
=>
{
let
{
surveyId
}
=
useParams
<
{
surveyId
:
string
}
>
();
const
navigate
=
useNavigate
();
function
editButtonClick
(
e
:
React
.
MouseEvent
<
HTMLButtonElement
>
)
{
/*
function editButtonClick(e: React.MouseEvent<HTMLButtonElement>) {
navigate(`/surveys/${surveyId}/edit`);
}
function resultButtonClick(e: React.MouseEvent<HTMLButtonElement>) {
navigate(`/surveys/${surveyId}/result`);
}*/
return
(
<
div
>
<
div
className
=
"flex place-content-center"
>
<
button
className
=
"text-xl m-3 underline decoration-4"
onClick
=
{
editButtonClick
}
<
NavLink
to
=
{
`/surveys/
${
surveyId
}
/edit`
}
style
=
{
({
isActive
})
=>
isActive
?
{
color
:
"
#58ACFA
"
}
:
{
color
:
"
black
"
}
}
>
설문지 수정
</
button
>
<
button
className
=
"text-xl m-3 underline"
/*onClick={}*/
<
div
className
=
"text-xl m-3 underline"
>
설문지 수정
</
div
>
</
NavLink
>
<
NavLink
to
=
{
`/surveys/
${
surveyId
}
/result`
}
style
=
{
({
isActive
})
=>
isActive
?
{
color
:
"
#58ACFA
"
}
:
{
color
:
"
black
"
}
}
>
응답결과
</
button
>
<
div
className
=
"text-xl m-3 underline"
>
응답결과
</
div
>
</
NavLink
>
</
div
>
<
Outlet
/>
</
div
>
...
...
frontend/src/survey/Result.tsx
deleted
100644 → 0
View file @
1f7641e8
import
React
from
"
react
"
;
frontend/src/survey/ResultSurvey.tsx
0 → 100644
View file @
72d4eb09
import
React
from
"
react
"
;
export
const
ResultSurvey
=
()
=>
{
return
(
<
div
className
=
"flex flex-col place-items-center"
>
<
div
className
=
"flex flex-col container place-items-center mt-4"
>
<
div
className
=
"font-bold text-4xl text-center m-2 border-b-2"
>
설문지 제목
</
div
>
<
div
className
=
"font-bold text-1xl text-center m-2 resize-none"
>
설문조사 설명
</
div
>
</
div
>
<
div
className
=
"w-11/12 h-16 rounded border-2 hover:border-themeColor"
>
1번 질문
</
div
>
</
div
>
);
};
src/routes/survey.route.ts
View file @
72d4eb09
...
...
@@ -14,7 +14,7 @@ router
.
route
(
"
/:surveyId
"
)
.
get
(
surveyCtrl
.
getSurveyById
);
router
.
route
(
"
/
edit/
:surveyId
"
)
.
route
(
"
/:surveyId
/edit
"
)
.
get
(
authCtrl
.
requireLogin
,
authCtrl
.
authenticate
,
surveyCtrl
.
getSurveyById
)
.
put
(
authCtrl
.
requireLogin
,
authCtrl
.
authenticate
,
surveyCtrl
.
updateSurvey
);
router
...
...
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