Commit 2fbb92ac authored by Timothy J. Baek's avatar Timothy J. Baek
Browse files

fix: tag validation

parent f96beeee
<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>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment