mirror of
https://github.com/open-webui/open-webui
synced 2025-04-28 02:01:41 +00:00
fix: disable empty fields
This commit is contained in:
parent
5017ca90ff
commit
a53537ccde
@ -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() === '') {
|
||||
toast.error($i18n.t('Please fill in all fields.'));
|
||||
name = '';
|
||||
description = '';
|
||||
loading = false;
|
||||
return;
|
||||
}
|
||||
|
||||
const res = await createNewKnowledge(localStorage.token, name, description).catch((e) => {
|
||||
toast.error(e);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user