Commit 5e91a8fd authored by Jiwon Yoon's avatar Jiwon Yoon
Browse files

설문지 삭제 확인(confirm)

parent 56d0596c
...@@ -28,11 +28,13 @@ export const MySurveyCard = ({ data }: Props) => { ...@@ -28,11 +28,13 @@ export const MySurveyCard = ({ data }: Props) => {
}; };
async function deleteSurvey() { async function deleteSurvey() {
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);
setSuccess(true); setSuccess(true);
setError(""); setError("");
alert("삭제되었습니다.");
location.reload(); location.reload();
} else { } else {
setLoading(true); setLoading(true);
...@@ -43,6 +45,9 @@ export const MySurveyCard = ({ data }: Props) => { ...@@ -43,6 +45,9 @@ export const MySurveyCard = ({ data }: Props) => {
} finally { } finally {
setLoading(false); setLoading(false);
} }
} else {
alert("삭제를 취소합니다.");
}
} }
return ( return (
......
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