Fix bug with fetching data
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
57a2d0f86e
commit
f0acdc88ec
1 changed files with 9 additions and 8 deletions
|
@ -1,18 +1,19 @@
|
|||
<script lang="ts">
|
||||
import * as api from "$lib/api";
|
||||
|
||||
// let fetchData = api.fetchData();
|
||||
let fetchData = [api.fetchData()];
|
||||
let fetchData = api.fetchData();
|
||||
// let fetchData = [api.fetchData()];
|
||||
let listingIndex = 0;
|
||||
|
||||
function updateListingIndex(amount: number): void {
|
||||
if (listingIndex == amount - 2) {
|
||||
fetchData.shift();
|
||||
fetchData.push(api.fetchData());
|
||||
}
|
||||
if (fetchData.length == 0) {
|
||||
fetchData.push(api.fetchData());
|
||||
// fetchData.shift();
|
||||
// fetchData.push(api.fetchData());
|
||||
fetchData = api.fetchData();
|
||||
}
|
||||
// if (fetchData.length == 0) {
|
||||
// fetchData.push(api.fetchData());
|
||||
// }
|
||||
|
||||
if (listingIndex >= amount - 1) {
|
||||
listingIndex = 0;
|
||||
|
@ -36,7 +37,7 @@
|
|||
</script>
|
||||
|
||||
<div class="brett center-box">
|
||||
{#await fetchData[0]}
|
||||
{#await fetchData}
|
||||
<p>Loading...</p>
|
||||
{:then data}
|
||||
{#if data.listings[listingIndex].type == api.ListingType.IMAGE}
|
||||
|
|
Loading…
Reference in a new issue