From c6dc4054be7018af490561455bc514194f282182 Mon Sep 17 00:00:00 2001 From: Austin Philp Date: Fri, 11 Nov 2022 15:41:50 -0800 Subject: [PATCH] Use `total` from listening-sessions endpoint to display total sessions --- client/pages/config/users/_id/index.vue | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/client/pages/config/users/_id/index.vue b/client/pages/config/users/_id/index.vue index 85f064a7..3cf44921 100644 --- a/client/pages/config/users/_id/index.vue +++ b/client/pages/config/users/_id/index.vue @@ -24,7 +24,7 @@

{{ $strings.HeaderListeningStats }}

-

{{ listeningSessions.length }} {{ $strings.HeaderListeningSessions }}

+

{{ this.listeningSessions.total }} {{ $strings.HeaderListeningSessions }}

{{ $strings.ButtonViewAll }}

@@ -111,6 +111,7 @@ export default { data() { return { listeningSessions: [], + totalSessions: 0, listeningStats: {}, purgingMediaProgress: false } @@ -147,8 +148,8 @@ export default { return this.listeningStats.today || 0 }, latestSession() { - if (!this.listeningSessions.length) return null - return this.listeningSessions[0] + if (!this.listeningSessions.sessions.length) return null + return this.listeningSessions.sessions[0] } }, methods: { @@ -159,11 +160,11 @@ export default { this.listeningSessions = await this.$axios .$get(`/api/users/${this.user.id}/listening-sessions?page=0&itemsPerPage=10`) .then((data) => { - return data.sessions || [] + return data || {} }) .catch((err) => { console.error('Failed to load listening sesions', err) - return [] + return {} }) this.listeningStats = await this.$axios.$get(`/api/users/${this.user.id}/listening-stats`).catch((err) => { console.error('Failed to load listening sesions', err) @@ -221,4 +222,4 @@ export default { padding: 4px 8px; font-size: 0.75rem; } - \ No newline at end of file +