feat: verplicht de gebruiker om een vraag te typen voordat hij submit
This commit is contained in:
parent
5c6e0b8554
commit
2b21cf4c53
1 changed files with 15 additions and 9 deletions
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue