-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Pagination #3
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, please take a look at my comments on Discord and let me know if you have questions
src/lib/pages/home/table.svelte
Outdated
$: { | ||
if (typeof currentPage === 'number') { | ||
const url = new URL(window.location.href); | ||
url.searchParams.set('page', currentPage.toString()); | ||
history.replaceState(null, '', url.toString()); | ||
} | ||
} | ||
|
||
console.log('apiMetadata', apiMetadata); | ||
onMount(() => { | ||
const params = new URLSearchParams(window.location.search); | ||
const pageParam = parseInt(params.get('page'), 10); | ||
currentPage = | ||
!isNaN(pageParam) && pageParam > 0 | ||
? pageParam | ||
: apiMetadata?.pagination?.currentPage || 1; | ||
currentOrder = apiMetadata?.sort?.order || 'desc'; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic is complex to manage and understand. However for now, I will let this get merged in
No description provided.