mirror of
https://github.com/BradNut/boredgame
synced 2025-09-08 17:40:22 +00:00
Remove console logs and only show pagination if length greater than 1.
This commit is contained in:
parent
fe2a88ab61
commit
da5328844f
2 changed files with 18 additions and 15 deletions
|
|
@ -35,10 +35,10 @@
|
|||
boredState.update((n) => ({ ...n, loading: true }));
|
||||
return async ({ result }) => {
|
||||
boredState.update((n) => ({ ...n, loading: false }));
|
||||
console.log('result main page search', result);
|
||||
// console.log('result main page search', result);
|
||||
// `result` is an `ActionResult` object
|
||||
if (result.type === 'success') {
|
||||
console.log('In success');
|
||||
// console.log('In success');
|
||||
const resultGames = result?.data?.games;
|
||||
if (resultGames?.length <= 0) {
|
||||
toast.send('No results found 😿', {
|
||||
|
|
@ -48,10 +48,10 @@
|
|||
});
|
||||
}
|
||||
gameStore.addAll(resultGames);
|
||||
console.log(`Frontend result random: ${JSON.stringify(result)}`);
|
||||
// console.log(`Frontend result random: ${JSON.stringify(result)}`);
|
||||
await applyAction(result);
|
||||
} else {
|
||||
console.log('Invalid');
|
||||
// console.log('Invalid');
|
||||
await applyAction(result);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
let totalItems = form?.totalCount || data?.totalCount || 0;
|
||||
$: skip = (page - 1) * pageSize;
|
||||
$: console.log('submit button', submitButton);
|
||||
$: showPagination = $gameStore?.length > 1;
|
||||
|
||||
let submitting = $boredState?.loading;
|
||||
let name = form?.name || '';
|
||||
|
|
@ -181,17 +182,19 @@
|
|||
/>
|
||||
{/each}
|
||||
</div>
|
||||
<Pagination
|
||||
{pageSize}
|
||||
{page}
|
||||
{totalItems}
|
||||
forwardText="Next"
|
||||
backwardText="Prev"
|
||||
pageSizes={[10, 25, 50, 100]}
|
||||
on:nextPageEvent={handleNextPageEvent}
|
||||
on:previousPageEvent={handlePreviousPageEvent}
|
||||
on:perPageEvent={handlePerPageEvent}
|
||||
/>
|
||||
{#if showPagination}
|
||||
<Pagination
|
||||
{pageSize}
|
||||
{page}
|
||||
{totalItems}
|
||||
forwardText="Next"
|
||||
backwardText="Prev"
|
||||
pageSizes={[10, 25, 50, 100]}
|
||||
on:nextPageEvent={handleNextPageEvent}
|
||||
on:previousPageEvent={handlePreviousPageEvent}
|
||||
on:perPageEvent={handlePerPageEvent}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
{:else if $boredState.loading}
|
||||
<div class="games">
|
||||
|
|
|
|||
Loading…
Reference in a new issue