feat: verplicht de gebruiker om een vraag te typen voordat hij submit

This commit is contained in:
Timo De Meyst 2025-04-24 15:42:09 +02:00
parent 5c6e0b8554
commit 2b21cf4c53

View file

@ -178,15 +178,21 @@ import type { GroupDTO } from "@dwengo-1/common/interfaces/group";
content: questionInput.value,
inGroup: group //TODO: POST response zegt dat dit null is???
}
createQuestionMutation.mutate(questionData, {
onSuccess: () => {
questionInput.value = "question:..."; // Clear the input field after submission
},
onError: (e) => {
console.error(e)
questionInput.value = ""; // Clear the input field after submission
},
})
console.log(questionData)
if (questionInput.value != "") {
createQuestionMutation.mutate(questionData, {
onSuccess: () => {
questionInput.value = "question:..."; // Clear the input field after submission
},
onError: (e) => {
console.error(e)
questionInput.value = ""; // Clear the input field after submission
},
})
} else {
alert("Please type a question before submitting.")
}
}
</script>