refactor: Abfrage in ein eigenes Modul ausgelagert.

This commit is contained in:
2021-12-15 17:47:02 +01:00
parent 3dd0f451fc
commit 45650a0f9a
5 changed files with 117 additions and 140 deletions
+5 -15
View File
@@ -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();