Commit 0ba15432 authored by Jiwon Yoon's avatar Jiwon Yoon
Browse files

질문 삭제 확인(confirm)

parent 5e91a8fd
...@@ -28,7 +28,7 @@ export const MySurveyCard = ({ data }: Props) => { ...@@ -28,7 +28,7 @@ export const MySurveyCard = ({ data }: Props) => {
}; };
async function deleteSurvey() { async function deleteSurvey() {
if (window.confirm("정말 삭제하시겠습니까?")) { if (window.confirm("해당 설문조사를 삭제하시겠습니까?")) {
try { try {
if (data._id) { if (data._id) {
const survey = await surveyApi.deleteSurvey(data._id); const survey = await surveyApi.deleteSurvey(data._id);
......
...@@ -50,11 +50,7 @@ export const Question = ({ ...@@ -50,11 +50,7 @@ export const Question = ({
selectedType === "checkbox" selectedType === "checkbox"
) { ) {
element.content = { element.content = {
choices: [ choices: [{ text: "", value: 0 }],
{ text: "", value: 0 },
{ text: "", value: 1 },
{ text: "", value: 2 },
],
}; };
} else if (selectedType === "essay") { } else if (selectedType === "essay") {
element.content = { choices: [] }; element.content = { choices: [] };
...@@ -62,11 +58,7 @@ export const Question = ({ ...@@ -62,11 +58,7 @@ export const Question = ({
element.content = { element.content = {
minRateDescription: "", minRateDescription: "",
maxRateDescription: "", maxRateDescription: "",
choices: [ choices: [{ text: "", value: 0 }],
{ text: "", value: 0 },
{ text: "", value: 1 },
{ text: "", value: 2 },
],
}; };
} }
element.type = selectedType; element.type = selectedType;
...@@ -129,8 +121,14 @@ export const Question = ({ ...@@ -129,8 +121,14 @@ export const Question = ({
handleQuestion(element._id); handleQuestion(element._id);
}; };
const handleDelete = () => { const handleDelete = () => {
deleteQuestion(element._id); if (window.confirm("질문을 삭제하시겠습니까?")) {
deleteQuestion(element._id);
alert("삭제되었습니다.");
} else {
alert("질문 삭제를 취소합니다.");
}
}; };
const handleEditClick = () => { const handleEditClick = () => {
setSave(false); setSave(false);
}; };
......
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