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">
 | 
			
		||||
	import { createEventDispatcher, getContext } from 'svelte';
 | 
			
		||||
	import { tags } from '$lib/stores';
 | 
			
		||||
	import { toast } from 'svelte-sonner';
 | 
			
		||||
	const dispatch = createEventDispatcher();
 | 
			
		||||
 | 
			
		||||
	const i18n = getContext('i18n');
 | 
			
		||||
| 
						 | 
				
			
			@ -10,9 +11,14 @@
 | 
			
		|||
	let tagName = '';
 | 
			
		||||
 | 
			
		||||
	const addTagHandler = async () => {
 | 
			
		||||
		dispatch('add', tagName);
 | 
			
		||||
		tagName = '';
 | 
			
		||||
		showTagInput = false;
 | 
			
		||||
		tagName = tagName.trim();
 | 
			
		||||
		if (tagName !== '') {
 | 
			
		||||
			dispatch('add', tagName);
 | 
			
		||||
			tagName = '';
 | 
			
		||||
			showTagInput = false;
 | 
			
		||||
		} else {
 | 
			
		||||
			toast.error('Invalid Tag');
 | 
			
		||||
		}
 | 
			
		||||
	};
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue