refactor: Abfrage in ein eigenes Modul ausgelagert.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<script>
|
||||
import Views from "./Views.svelte";
|
||||
import {WorkingHoursViewsRepository} from "../components/Repositories.svelte";
|
||||
export let params;
|
||||
params = {
|
||||
title: 'Wochenansicht',
|
||||
@@ -8,21 +9,10 @@
|
||||
}
|
||||
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);
|
||||
});
|
||||
WorkingHoursViewsRepository.weekly().then(data => {
|
||||
params.records = data;
|
||||
params.isLoading = false;
|
||||
})
|
||||
}
|
||||
};
|
||||
View.browse();
|
||||
|
||||
Reference in New Issue
Block a user