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