mirror of
https://github.com/open-webui/open-webui
synced 2025-05-24 06:44:24 +00:00
fix: disable empty fields
This commit is contained in:
parent
5017ca90ff
commit
a53537ccde
@ -40,6 +40,13 @@
|
|||||||
<form
|
<form
|
||||||
class="flex flex-col w-full"
|
class="flex flex-col w-full"
|
||||||
on:submit|preventDefault={() => {
|
on:submit|preventDefault={() => {
|
||||||
|
if (name.trim() === '' || content.trim() === '') {
|
||||||
|
toast.error($i18n.t('Please fill in all fields.'));
|
||||||
|
name = '';
|
||||||
|
content = '';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
dispatch('submit', {
|
dispatch('submit', {
|
||||||
name,
|
name,
|
||||||
content
|
content
|
||||||
|
@ -15,6 +15,14 @@
|
|||||||
const submitHandler = async () => {
|
const submitHandler = async () => {
|
||||||
loading = true;
|
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) => {
|
const res = await createNewKnowledge(localStorage.token, name, description).catch((e) => {
|
||||||
toast.error(e);
|
toast.error(e);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user