diff --git a/client/pages/config/users/_id/index.vue b/client/pages/config/users/_id/index.vue index 85f064a7..80ef4c62 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 }}

+

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

{{ $strings.ButtonViewAll }}

@@ -110,7 +110,7 @@ export default { }, data() { return { - listeningSessions: [], + listeningSessions: {}, listeningStats: {}, purgingMediaProgress: false } @@ -147,8 +147,8 @@ export default { return this.listeningStats.today || 0 }, latestSession() { - if (!this.listeningSessions.length) return null - return this.listeningSessions[0] + if (!this.listeningSessions.sessions || !this.listeningSessions.sessions.length) return null + return this.listeningSessions.sessions[0] } }, methods: { @@ -159,11 +159,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 +221,4 @@ export default { padding: 4px 8px; font-size: 0.75rem; } - \ No newline at end of file +