@@ -40,6 +40,13 @@
<form
class="flex flex-col w-full"
on:submit|preventDefault={() => {
+ if (name.trim() === '' || content.trim() === '') {
+ toast.error($i18n.t('Please fill in all fields.'));
+ name = '';
+ content = '';
+ return;
+ }
+
dispatch('submit', {
name,
content
@@ -15,6 +15,14 @@
const submitHandler = async () => {
loading = true;
+ if (name.trim() === '' || description.trim() === '') {
+ description = '';
+ loading = false;
const res = await createNewKnowledge(localStorage.token, name, description).catch((e) => {
toast.error(e);
});