Add query parameter to fetchCards function
This commit is contained in:
parent
1115b61e06
commit
9e5a122820
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user