{ boredState.update((n) => ({ ...n, loading: true })); return async ({ result }) => { boredState.update((n) => ({ ...n, loading: false })); console.log(result); // `result` is an `ActionResult` object if (result.type === 'error') { toast.send('Error!', { duration: 3000, type: ToastType.ERROR, dismissible: true }); await applyAction(result); } else if (result.type === 'success') { gameStore.removeAll(); gameStore.addAll(result?.data?.games); // totalItems = result?.data?.totalCount; console.log(`Frontend result: ${JSON.stringify(result)}`); toast.send('Sucess!', { duration: 3000, type: ToastType.INFO, dismissible: true }); await applyAction(result); } else { await applyAction(result); } }; }} >
{#if $gameStore?.length > 0}
Games Found:
{#each $gameStore as game (game.id)}
{/each}
{:else if form && form?.status && form.status !== 200}
There was an error searching for games!
Please try again later.
{/if}