From 1ed702b3529a138a1213c6f311353bdee5fc3d79 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 26 Oct 2022 19:52:49 +0200 Subject: [PATCH] fix: pagination --- src/lib/components/pagination.svelte | 7 +++---- .../console/project-[project]/functions/[[page]]/+page.ts | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/lib/components/pagination.svelte b/src/lib/components/pagination.svelte index d58e6b7ec..4b09f2871 100644 --- a/src/lib/components/pagination.svelte +++ b/src/lib/components/pagination.svelte @@ -4,11 +4,10 @@ export let offset: number; export let path: string; export let hidePages = false; - $: totalPages = Math.ceil(sum / limit); $: currentPage = Math.floor(offset / limit + 1); $: pages = pagination(currentPage, totalPages); - + $: console.log({ sum, limit, totalPages, currentPage, pages }); function pagination(page: number, total: number) { const pagesShown = 5; const start = Math.max( @@ -33,7 +32,7 @@ class:is-disabled={currentPage <= 1} class="button is-text" aria-label="prev page" - href={`${path}/${1}`}> + href={`${path}/${currentPage - 1}`}>