31 lines
815 B
Svelte
31 lines
815 B
Svelte
<script>
|
|
import Views from "./Views.svelte";
|
|
export let params;
|
|
params = {
|
|
title: 'Wochenansicht',
|
|
records: [],
|
|
isLoading: true
|
|
}
|
|
const View = {
|
|
'browse': () => {
|
|
fetch(env.API_URL + '/views/working-hours/weekly')
|
|
.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} /> |