diff --git a/src/lib/components/search/random/index.svelte b/src/lib/components/search/random/index.svelte index 441a80d..835cd73 100644 --- a/src/lib/components/search/random/index.svelte +++ b/src/lib/components/search/random/index.svelte @@ -1,43 +1,72 @@ -
-
- - -
+ { + boredState.update((n) => ({ ...n, loading: true })); + return async ({ result }) => { + boredState.update((n) => ({ ...n, loading: false })); + console.log('result main page search', result); + // `result` is an `ActionResult` object + if (result.type === 'success') { + console.log('In success'); + gameStore.removeAll(); + const resultGames = result?.data?.games; + if (resultGames?.length <= 0) { + toast.send('No results!', { duration: 3000, type: ToastType.INFO, dismissible: true }); + } + gameStore.addAll(resultGames); + console.log(`Frontend result: ${JSON.stringify(result)}`); + await applyAction(result); + } else { + console.log('Invalid'); + await applyAction(result); + } + }; + }} +> +
+ + +
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 62e1af6..8527455 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -73,7 +73,7 @@

Search Boardgames!

- Input your requirements to search for board game that match your criteria. + Input your requirements to search for board games that match your criteria.