Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
2fbb92ac
Commit
2fbb92ac
authored
Mar 29, 2024
by
Timothy J. Baek
Browse files
fix: tag validation
parent
f96beeee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
src/lib/components/common/Tags/TagInput.svelte
src/lib/components/common/Tags/TagInput.svelte
+9
-3
No files found.
src/lib/components/common/Tags/TagInput.svelte
View file @
2fbb92ac
<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 @@
...
@@ -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>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment