diff --git a/src/lib/components/Childrenpage.svelte b/src/lib/components/Childrenpage.svelte
index 0dddcc7e..26bece61 100644
--- a/src/lib/components/Childrenpage.svelte
+++ b/src/lib/components/Childrenpage.svelte
@@ -54,40 +54,43 @@
children,
createDummyData,
fetchChildrenDataforUser,
- type ChildData,
- type ChildrenList
+ type ChildData
} from '$lib/stores/childrenStore';
import { Heading } from 'flowbite-svelte';
- import { onDestroy, onMount } from 'svelte';
+ import { onMount } from 'svelte';
// create data and
let data: ChildData[] = [];
+ let loading = true;
- const unsubscribe = children.subscribe(async (childlist: ChildrenList) => {
+ async function init() {
+ loading = true;
+ children.set({});
+ await createDummyData();
let rawdata = await fetchChildrenDataforUser('dummyUser');
data = convertData(rawdata);
- });
+ loading = false;
+ }
// this fetches dummy child data for the dummy user whenever the component is mounted into the dom
// it is conceptualized as emulating an API call that would normally fetch this from the server.
- onMount(async () => {
- children.set({});
- await createDummyData();
- });
-
- onDestroy(unsubscribe);
+ onMount(init);
- Wählen sie ein Kind zur Beobachtung aus oder legen melden sie ein neues Kind an. -
-Daten werden geladen...
+ {:else} ++ Wählen sie ein Kind zur Beobachtung aus oder legen melden sie ein neues Kind an. +
+