mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-12-09 21:39:37 +00:00
New data model update MeController user progress routes
This commit is contained in:
parent
c4eeb1cfb7
commit
1cf9e85272
13 changed files with 234 additions and 281 deletions
|
|
@ -104,12 +104,18 @@ export const mutations = {
|
|||
localStorage.removeItem('token')
|
||||
}
|
||||
},
|
||||
updateUserAudiobook(state, { id, data }) {
|
||||
updateItemProgress(state, { id, data }) {
|
||||
if (!state.user) return
|
||||
if (!state.user.audiobooks) {
|
||||
Vue.set(state.user, 'audiobooks', {})
|
||||
if (!data) {
|
||||
state.user.libraryItemProgress = state.user.libraryItemProgress.filter(lip => lip.id != id)
|
||||
} else {
|
||||
var indexOf = state.user.libraryItemProgress.findIndex(lip => lip.id == id)
|
||||
if (indexOf >= 0) {
|
||||
state.user.libraryItemProgress.splice(indexOf, 1, data)
|
||||
} else {
|
||||
state.user.libraryItemProgress.push(data)
|
||||
}
|
||||
}
|
||||
Vue.set(state.user.audiobooks, id, data)
|
||||
},
|
||||
setSettings(state, settings) {
|
||||
if (!settings) return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue