Die Daten für die Ansichten werden von einer API abgefragt.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<script>
|
||||
import Views from "./Views.svelte";
|
||||
export let params;
|
||||
params = {
|
||||
title: 'Monatsansicht',
|
||||
records: [],
|
||||
isLoading: true
|
||||
}
|
||||
const View = {
|
||||
'browse': () => {
|
||||
fetch(env.API_URL + '/views/working-hours/monthly')
|
||||
.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);
|
||||
});
|
||||
}
|
||||
};
|
||||
View.browse();
|
||||
</script>
|
||||
|
||||
<Views {params} />
|
||||
Reference in New Issue
Block a user