mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-08 00:08:14 +01:00
Update home page shelves to handle share open/closed sockets
This commit is contained in:
parent
af92ae4d51
commit
0918391636
@ -408,6 +408,36 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
shareOpen(mediaItemShare) {
|
||||||
|
this.shelves.forEach((shelf) => {
|
||||||
|
if (shelf.type == 'book') {
|
||||||
|
shelf.entities = shelf.entities.map((ent) => {
|
||||||
|
if (ent.media.id === mediaItemShare.mediaItemId) {
|
||||||
|
return {
|
||||||
|
...ent,
|
||||||
|
mediaItemShare
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ent
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
shareClosed(mediaItemShare) {
|
||||||
|
this.shelves.forEach((shelf) => {
|
||||||
|
if (shelf.type == 'book') {
|
||||||
|
shelf.entities = shelf.entities.map((ent) => {
|
||||||
|
if (ent.media.id === mediaItemShare.mediaItemId) {
|
||||||
|
return {
|
||||||
|
...ent,
|
||||||
|
mediaItemShare: null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ent
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
initListeners() {
|
initListeners() {
|
||||||
if (this.$root.socket) {
|
if (this.$root.socket) {
|
||||||
this.$root.socket.on('user_updated', this.userUpdated)
|
this.$root.socket.on('user_updated', this.userUpdated)
|
||||||
@ -419,6 +449,8 @@ export default {
|
|||||||
this.$root.socket.on('items_updated', this.libraryItemsUpdated)
|
this.$root.socket.on('items_updated', this.libraryItemsUpdated)
|
||||||
this.$root.socket.on('items_added', this.libraryItemsAdded)
|
this.$root.socket.on('items_added', this.libraryItemsAdded)
|
||||||
this.$root.socket.on('episode_added', this.episodeAdded)
|
this.$root.socket.on('episode_added', this.episodeAdded)
|
||||||
|
this.$root.socket.on('share_open', this.shareOpen)
|
||||||
|
this.$root.socket.on('share_closed', this.shareClosed)
|
||||||
} else {
|
} else {
|
||||||
console.error('Error socket not initialized')
|
console.error('Error socket not initialized')
|
||||||
}
|
}
|
||||||
@ -434,6 +466,8 @@ export default {
|
|||||||
this.$root.socket.off('items_updated', this.libraryItemsUpdated)
|
this.$root.socket.off('items_updated', this.libraryItemsUpdated)
|
||||||
this.$root.socket.off('items_added', this.libraryItemsAdded)
|
this.$root.socket.off('items_added', this.libraryItemsAdded)
|
||||||
this.$root.socket.off('episode_added', this.episodeAdded)
|
this.$root.socket.off('episode_added', this.episodeAdded)
|
||||||
|
this.$root.socket.off('share_open', this.shareOpen)
|
||||||
|
this.$root.socket.off('share_closed', this.shareClosed)
|
||||||
} else {
|
} else {
|
||||||
console.error('Error socket not initialized')
|
console.error('Error socket not initialized')
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user