forked from open-webui/open-webui
fix: tag validation
This commit is contained in:
parent
f96beeee8f
commit
2fbb92aceb
1 changed files with 9 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { createEventDispatcher, getContext } from 'svelte';
|
import { createEventDispatcher, getContext } from 'svelte';
|
||||||
import { tags } from '$lib/stores';
|
import { tags } from '$lib/stores';
|
||||||
|
import { toast } from 'svelte-sonner';
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
|
|
||||||
const i18n = getContext('i18n');
|
const i18n = getContext('i18n');
|
||||||
|
@ -10,9 +11,14 @@
|
||||||
let tagName = '';
|
let tagName = '';
|
||||||
|
|
||||||
const addTagHandler = async () => {
|
const addTagHandler = async () => {
|
||||||
dispatch('add', tagName);
|
tagName = tagName.trim();
|
||||||
tagName = '';
|
if (tagName !== '') {
|
||||||
showTagInput = false;
|
dispatch('add', tagName);
|
||||||
|
tagName = '';
|
||||||
|
showTagInput = false;
|
||||||
|
} else {
|
||||||
|
toast.error('Invalid Tag');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue