From 85d5531bc162eaa1a5a24fddb27b460cf320f5db Mon Sep 17 00:00:00 2001 From: advplyr Date: Sun, 7 Sep 2025 17:50:59 -0500 Subject: [PATCH] Update chapter editor remove redirect on save or delete all #4650 --- client/pages/audiobook/_id/chapters.vue | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/client/pages/audiobook/_id/chapters.vue b/client/pages/audiobook/_id/chapters.vue index a62c5f7af..cf254165b 100644 --- a/client/pages/audiobook/_id/chapters.vue +++ b/client/pages/audiobook/_id/chapters.vue @@ -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() {