Moved loading to onmount

This commit is contained in:
Nicolai Ort 2023-05-04 20:17:29 +02:00
parent b6fed92a17
commit 4e0a2c8301
Signed by: niggl
GPG Key ID: 13AFA55AF62F269F

View File

@ -8,7 +8,7 @@
RunnerService,
} from "@odit/lfk-client-js";
import Select from "svelte-select";
import { createEventDispatcher } from "svelte";
import { createEventDispatcher, onMount } from "svelte";
import toast from "svelte-french-toast";
export let modal_open;
const dispatch = createEventDispatcher();
@ -23,16 +23,6 @@
$: runners = [];
$: is_fixed = false;
$: is_paid = false;
DonorService.donorControllerGetAll().then((val) => {
donors = val.map((r) => {
return { label: getDonorLabel(r), value: r };
});
});
RunnerService.runnerControllerGetAll().then((val) => {
runners = val.map((r) => {
return { label: getDonorLabel(r), value: r };
});
});
$: amount_input = 0;
$: processed_last_submit = true;
$: is_amount_valid = amount_input > 0;
@ -108,6 +98,19 @@
}
}
}
onMount(() => {
DonorService.donorControllerGetAll().then((val) => {
donors = val.map((r) => {
return { label: getDonorLabel(r), value: r };
});
});
RunnerService.runnerControllerGetAll().then((val) => {
runners = val.map((r) => {
return { label: getDonorLabel(r), value: r };
});
});
});
</script>
{#if modal_open}