Add query parameter to fetchCards function

This commit is contained in:
qowevisa 2024-11-24 00:30:59 +02:00
parent 1115b61e06
commit 9e5a122820

View File

@ -22,11 +22,14 @@
onMount(async () => {
await fetchCategories();
await fetchCards();
await fetchCards(true);
});
async function fetchCards() {
const result = await fetch("/api/card/all");
async function fetchCards(preloadCurrencies = false) {
const queryParams = new URLSearchParams({
preload_currencies: preloadCurrencies.toString(),
});
const result = await fetch(`/api/card/all?${queryParams}`);
if (!result.ok) {
const obj = await result.json();
error = obj.message;