From 0b7d26f150f38bcecc033744ff956032be025aff Mon Sep 17 00:00:00 2001 From: Dominic Grimm Date: Tue, 2 Aug 2022 11:29:17 +0200 Subject: [PATCH] Update api fetching --- docker/schwarzesbrett/src/routes/index.svelte | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docker/schwarzesbrett/src/routes/index.svelte b/docker/schwarzesbrett/src/routes/index.svelte index 3faae1f..e916a15 100644 --- a/docker/schwarzesbrett/src/routes/index.svelte +++ b/docker/schwarzesbrett/src/routes/index.svelte @@ -5,9 +5,12 @@ let listingIndex = 0; function updateListingIndex(amount: number): void { + if (listingIndex == amount - 2) { + fetchData = api.fetchData(); + } + if (listingIndex >= amount - 1) { listingIndex = 0; - fetchData = api.fetchData(); } else { listingIndex++; }