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 () => { onMount(async () => {
await fetchCategories(); await fetchCategories();
await fetchCards(); await fetchCards(true);
}); });
async function fetchCards() { async function fetchCards(preloadCurrencies = false) {
const result = await fetch("/api/card/all"); const queryParams = new URLSearchParams({
preload_currencies: preloadCurrencies.toString(),
});
const result = await fetch(`/api/card/all?${queryParams}`);
if (!result.ok) { if (!result.ok) {
const obj = await result.json(); const obj = await result.json();
error = obj.message; error = obj.message;