diff --git a/src/lib/components/search/textSearch/index.svelte b/src/lib/components/search/textSearch/index.svelte index 09891a1..bbbf60e 100644 --- a/src/lib/components/search/textSearch/index.svelte +++ b/src/lib/components/search/textSearch/index.svelte @@ -1,7 +1,7 @@ + const submitSearch: SubmitFunction = ({ form, data, action, cancel }) => { + const { name } = Object.fromEntries(data); + if (!disclosureOpen && name?.length === 0) { + toast.send('Please enter a search term', { + duration: 3000, + type: ToastType.ERROR, + dismissible: true + }); + cancel(); + return; + } -
{ gameStore.removeAll(); boredState.update((n) => ({ ...n, loading: true })); return async ({ result }) => { @@ -126,14 +129,19 @@ gameStore.removeAll(); gameStore.addAll(result?.data?.games); totalItems = result?.data?.totalCount; - // toast.send('Sucess!', { duration: 3000, type: ToastType.INFO, dismissible: true }); + // toast.send('Success!', { duration: 3000, type: ToastType.INFO, dismissible: true }); await applyAction(result); } else { await applyAction(result); } }; - }} -> + }; + + // TODO: Keep all Pagination Values on back and forth browser + // TODO: Add cache for certain number of pages so back and forth doesn't request data again + + + + {#if $collectionStore.length !== 0} + + {/if}