Commit 5b5755eb authored by Lee SeoYeon's avatar Lee SeoYeon
Browse files

title, content, text 입력시 확인체크 할 수 있도록 완료

parent 34980609
...@@ -18,12 +18,17 @@ export const Question = ({ ...@@ -18,12 +18,17 @@ export const Question = ({
const isEditing = question.isEditing; const isEditing = question.isEditing;
async function handleEditComplete() { async function handleEditComplete() {
if (question.content.length < 0 || question.title.length > 1) { switch (question.type) {
question.isEditing = false; case "rating":
handleQuestion(question); case "checkbox":
} case "radio":
case "dropdown":
question.content.choices.map((choice) => { question.content.choices.map((choice) => {
if (question.title.length < 1 || choice.text.trim() === "") { if (
question.title.length < 1 ||
question.content.length < 0 ||
choice.text.trim() === ""
) {
alert("빈칸을 채워주세요"); alert("빈칸을 채워주세요");
return (question.isEditing = true); return (question.isEditing = true);
} else { } else {
...@@ -32,6 +37,17 @@ export const Question = ({ ...@@ -32,6 +37,17 @@ export const Question = ({
handleQuestion(question); handleQuestion(question);
} }
}); });
break;
default:
if (question.title === "") {
alert("제목을 입력해주세요");
question.isEditing = true;
} else {
question.isEditing = false;
handleQuestion(question);
}
break;
}
} }
function handleSelect(event: React.ChangeEvent<HTMLSelectElement>) { function handleSelect(event: React.ChangeEvent<HTMLSelectElement>) {
......
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