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

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

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