diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/api.ts | 2 | ||||
-rw-r--r-- | src/routes/auctionprices.svelte | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/lib/api.ts b/src/lib/api.ts index 1721d01..e3559e1 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -1,3 +1,3 @@ // the trailing slash is required export const API_URL = 'https://skyblock-api.matdoes.dev/' -// export const API_URL = 'http://localhost:8080/' +// export const API_URL = 'http://localhost:8080/'
\ No newline at end of file diff --git a/src/routes/auctionprices.svelte b/src/routes/auctionprices.svelte index 0ef7d3f..3c57e1e 100644 --- a/src/routes/auctionprices.svelte +++ b/src/routes/auctionprices.svelte @@ -55,7 +55,10 @@ } async function fetchItems(itemIds: null | string[]): Promise<ItemAuctionsSchema[]> { let url = `${API_URL}auctionprices` - if (itemIds !== null) url += `?items=${itemIds.join(',')}` + if (itemIds !== null) { + if (itemIds.length === 0) return [] + url += `?items=${itemIds.join(',')}` + } return await fetch(url).then(r => r.json()) } @@ -81,7 +84,7 @@ if (itemIds.length > 0) { const shownIds = data.map(d => d.id) const items = (await fetchItems(itemIds)).filter(i => !shownIds.includes(i.id)) - data = [...data, ...items] + if (items.length > 0) data = [...data, ...items] } loadingPage = false } |