Update chapter editor remove redirect on save or delete all #4650

This commit is contained in:
advplyr 2025-09-07 17:50:59 -05:00
parent 4b840f9c97
commit 85d5531bc1

View File

@ -697,11 +697,7 @@ export default {
this.saving = false
if (data.updated) {
this.$toast.success(this.$strings.ToastChaptersUpdated)
if (this.previousRoute) {
this.$router.push(this.previousRoute)
} else {
this.$router.push(`/item/${this.libraryItem.id}`)
}
this.reloadLibraryItem()
} else {
this.$toast.info(this.$strings.MessageNoUpdatesWereNecessary)
}
@ -874,11 +870,7 @@ export default {
.then((data) => {
if (data.updated) {
this.$toast.success(this.$strings.ToastChaptersRemoved)
if (this.previousRoute) {
this.$router.push(this.previousRoute)
} else {
this.$router.push(`/item/${this.libraryItem.id}`)
}
this.reloadLibraryItem()
} else {
this.$toast.info(this.$strings.MessageNoUpdatesWereNecessary)
}
@ -983,6 +975,18 @@ export default {
}
this.libraryItem = libraryItem
}
},
reloadLibraryItem() {
this.$axios
.$get(`/api/items/${this.libraryItem.id}?expanded=1`)
.then((data) => {
this.libraryItem = data
this.initChapters()
})
.catch((error) => {
console.error('Failed to reload library item', error)
this.$toast.error(this.$strings.ToastFailedToLoadData)
})
}
},
mounted() {