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 }));
|
boredState.update((n) => ({ ...n, loading: true }));
|
||||||
return async ({ result }) => {
|
return async ({ result }) => {
|
||||||
boredState.update((n) => ({ ...n, loading: false }));
|
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
|
// `result` is an `ActionResult` object
|
||||||
if (result.type === 'success') {
|
if (result.type === 'success') {
|
||||||
console.log('In success');
|
// console.log('In success');
|
||||||
const resultGames = result?.data?.games;
|
const resultGames = result?.data?.games;
|
||||||
if (resultGames?.length <= 0) {
|
if (resultGames?.length <= 0) {
|
||||||
toast.send('No results found 😿', {
|
toast.send('No results found 😿', {
|
||||||
|
|
@ -48,10 +48,10 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
gameStore.addAll(resultGames);
|
gameStore.addAll(resultGames);
|
||||||
console.log(`Frontend result random: ${JSON.stringify(result)}`);
|
// console.log(`Frontend result random: ${JSON.stringify(result)}`);
|
||||||
await applyAction(result);
|
await applyAction(result);
|
||||||
} else {
|
} else {
|
||||||
console.log('Invalid');
|
// console.log('Invalid');
|
||||||
await applyAction(result);
|
await applyAction(result);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@
|
||||||
let totalItems = form?.totalCount || data?.totalCount || 0;
|
let totalItems = form?.totalCount || data?.totalCount || 0;
|
||||||
$: skip = (page - 1) * pageSize;
|
$: skip = (page - 1) * pageSize;
|
||||||
$: console.log('submit button', submitButton);
|
$: console.log('submit button', submitButton);
|
||||||
|
$: showPagination = $gameStore?.length > 1;
|
||||||
|
|
||||||
let submitting = $boredState?.loading;
|
let submitting = $boredState?.loading;
|
||||||
let name = form?.name || '';
|
let name = form?.name || '';
|
||||||
|
|
@ -181,17 +182,19 @@
|
||||||
/>
|
/>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
<Pagination
|
{#if showPagination}
|
||||||
{pageSize}
|
<Pagination
|
||||||
{page}
|
{pageSize}
|
||||||
{totalItems}
|
{page}
|
||||||
forwardText="Next"
|
{totalItems}
|
||||||
backwardText="Prev"
|
forwardText="Next"
|
||||||
pageSizes={[10, 25, 50, 100]}
|
backwardText="Prev"
|
||||||
on:nextPageEvent={handleNextPageEvent}
|
pageSizes={[10, 25, 50, 100]}
|
||||||
on:previousPageEvent={handlePreviousPageEvent}
|
on:nextPageEvent={handleNextPageEvent}
|
||||||
on:perPageEvent={handlePerPageEvent}
|
on:previousPageEvent={handlePreviousPageEvent}
|
||||||
/>
|
on:perPageEvent={handlePerPageEvent}
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{:else if $boredState.loading}
|
{:else if $boredState.loading}
|
||||||
<div class="games">
|
<div class="games">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue