mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-05 01:19:34 +02:00
Update:Save after editing chapters redirects to previous page #827
This commit is contained in:
parent
c453d3e8c7
commit
5db949e4a7
@ -138,7 +138,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
async asyncData({ store, params, app, redirect, route }) {
|
async asyncData({ store, params, app, redirect, from }) {
|
||||||
if (!store.getters['user/getUserCanUpdate']) {
|
if (!store.getters['user/getUserCanUpdate']) {
|
||||||
return redirect('/?error=unauthorized')
|
return redirect('/?error=unauthorized')
|
||||||
}
|
}
|
||||||
@ -154,8 +154,12 @@ export default {
|
|||||||
console.error('Invalid media type')
|
console.error('Invalid media type')
|
||||||
return redirect('/')
|
return redirect('/')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var previousRoute = from ? from.fullPath : null
|
||||||
|
if (from && from.path === '/login') previousRoute = null
|
||||||
return {
|
return {
|
||||||
libraryItem
|
libraryItem,
|
||||||
|
previousRoute
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -342,7 +346,6 @@ export default {
|
|||||||
|
|
||||||
this.saving = true
|
this.saving = true
|
||||||
|
|
||||||
console.log('udpated chapters', this.newChapters)
|
|
||||||
const payload = {
|
const payload = {
|
||||||
chapters: this.newChapters
|
chapters: this.newChapters
|
||||||
}
|
}
|
||||||
@ -352,7 +355,11 @@ export default {
|
|||||||
this.saving = false
|
this.saving = false
|
||||||
if (data.updated) {
|
if (data.updated) {
|
||||||
this.$toast.success('Chapters updated')
|
this.$toast.success('Chapters updated')
|
||||||
this.$router.push(`/item/${this.libraryItem.id}`)
|
if (this.previousRoute) {
|
||||||
|
this.$router.push(this.previousRoute)
|
||||||
|
} else {
|
||||||
|
this.$router.push(`/item/${this.libraryItem.id}`)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.$toast.info('No changes needed updating')
|
this.$toast.info('No changes needed updating')
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user