mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-11-08 09:04:43 +01:00
Use total
from listening-sessions endpoint to display total sessions
This commit is contained in:
parent
fdf67e17a0
commit
c6dc4054be
@ -24,7 +24,7 @@
|
||||
<div class="py-2">
|
||||
<h1 class="text-lg mb-2 text-white text-opacity-90 px-2 sm:px-0">{{ $strings.HeaderListeningStats }}</h1>
|
||||
<div class="flex items-center">
|
||||
<p class="text-sm text-gray-300">{{ listeningSessions.length }} {{ $strings.HeaderListeningSessions }}</p>
|
||||
<p class="text-sm text-gray-300">{{ this.listeningSessions.total }} {{ $strings.HeaderListeningSessions }}</p>
|
||||
<ui-btn :to="`/config/users/${user.id}/sessions`" class="text-xs mx-2" :padding-x="1.5" :padding-y="1">{{ $strings.ButtonViewAll }}</ui-btn>
|
||||
</div>
|
||||
<p class="text-sm text-gray-300">
|
||||
@ -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;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
Loading…
Reference in New Issue
Block a user