From 3450ce6f871c1aae9d3cd21d2d1b4fb3364b0da5 Mon Sep 17 00:00:00 2001 From: Marcel Schwarz Date: Sun, 20 Sep 2020 03:11:48 +0200 Subject: [PATCH] Make StatisticsOverview and WeekSummary async --- .../views/statistics/StatisticOverview.vue | 36 ++++++++++++++++--- .../views/statistics/charts/WeekSummary.vue | 23 ++++++++++-- 2 files changed, 52 insertions(+), 7 deletions(-) diff --git a/frontend/src/views/statistics/StatisticOverview.vue b/frontend/src/views/statistics/StatisticOverview.vue index 08e17f7..d2e7f09 100644 --- a/frontend/src/views/statistics/StatisticOverview.vue +++ b/frontend/src/views/statistics/StatisticOverview.vue @@ -2,7 +2,7 @@
- + @@ -13,12 +13,12 @@ - + - +
@@ -30,6 +30,8 @@ import MonthSummary from "./charts/MonthSummary.vue"; import WorkPausePie from "./charts/WorkPausePie.vue"; import AccountPie from "./charts/AccountPie.vue"; + import axios from "axios" + import {BASE_URI} from "../../globals" export default { name: "StatisticOverview", @@ -39,8 +41,34 @@ MonthSummary, WorkPausePie, AccountPie + }, + data() { + return { + accounts: [], + records: [] + } + }, + async mounted() { + let recordsResponse + let link = BASE_URI + "/records/search/allForUser?" + + "username=" + sessionStorage.getItem("username") + "&" + + "projection=overview" + do { + recordsResponse = await axios.get(link) + link = recordsResponse.data._links?.next?.href + this.records.push(...recordsResponse.data._embedded.records) + } while (link) + + let accountsResponse + link = BASE_URI + "/accounts/search/findByUsername?" + + "username=" + sessionStorage.getItem("username") + do { + accountsResponse = await axios.get(link) + link = accountsResponse.data._links?.next?.href + this.accounts.push(...accountsResponse.data._embedded.accounts) + } while(link) } - }; + }