diff --git a/ui/src/routes/WorkingHours.svelte b/ui/src/routes/WorkingHours.svelte index e2da199..67936ab 100644 --- a/ui/src/routes/WorkingHours.svelte +++ b/ui/src/routes/WorkingHours.svelte @@ -7,6 +7,48 @@ import checkIcon from '@iconify-icons/oi/check'; import xIcon from '@iconify-icons/oi/x'; let activeRecord = null; + params = { + title: 'Einträge', + records: [], + isLoading: true + } + const Records = { + 'browse': () => { + // noinspection JSUnresolvedVariable + fetch(env.API_URL + '/working-hours') + .then(res => { + if (!res.ok) { + throw new Error('Fail!'); + } + return res.json(); + }) + .then(data => { + params.records = data; + params.isLoading = false; + }) + .catch(err => { + params.isLoading = false; + console.log(err); + }); + }, + 'read': date => { + // noinspection JSUnresolvedVariable + fetch(env.API_URL + '/working-hours/' + date) + .then(res => { + if (!res.ok) { + throw new Error('Fail!'); + } + return res.json(); + }) + .then(data => { + activeRecord = data; + }) + .catch(err => { + console.log(err); + }); + } + }; + Records.browse(); @@ -33,7 +75,7 @@ {record.workingDay} {record.workingTime} - + @@ -53,18 +95,16 @@
-
-
- +