fix(webui): context navigation messed up

This commit is contained in:
Gauthier Roebroeck 2021-01-06 16:43:29 +08:00
parent 6bf31f50c3
commit ba6166031b
2 changed files with 15 additions and 25 deletions

View file

@ -587,11 +587,6 @@ export default Vue.extend({
this.contextName = (await (this.$komgaReadLists.getOneReadList(this.context.id))).name
document.title = `Komga - ${this.contextName} - ${this.book.metadata.title}`
} else {
this.context = {
origin: ContextOrigin.SERIES,
id: this.book.seriesId,
}
this.contextName = this.series.metadata.title
document.title = `Komga - ${getBookTitleCompact(this.book.metadata.title, this.series.metadata.title)}`
}
@ -617,19 +612,19 @@ export default Vue.extend({
}
try {
if (this?.context.origin === ContextOrigin.SERIES) {
this.siblingNext = await this.$komgaBooks.getBookSiblingNext(bookId)
} else if (this.context.origin === ContextOrigin.READLIST) {
if (this?.context.origin === ContextOrigin.READLIST) {
this.siblingNext = await this.$komgaReadLists.getBookSiblingNext(this.context.id, bookId)
} else {
this.siblingNext = await this.$komgaBooks.getBookSiblingNext(bookId)
}
} catch (e) {
this.siblingNext = {} as BookDto
}
try {
if (this?.context.origin === ContextOrigin.SERIES) {
this.siblingPrevious = await this.$komgaBooks.getBookSiblingPrevious(bookId)
} else if (this.context.origin === ContextOrigin.READLIST) {
if (this?.context.origin === ContextOrigin.READLIST) {
this.siblingPrevious = await this.$komgaReadLists.getBookSiblingPrevious(this.context.id, bookId)
} else {
this.siblingPrevious = await this.$komgaBooks.getBookSiblingPrevious(bookId)
}
} catch (e) {
this.siblingPrevious = {} as BookDto

View file

@ -333,18 +333,13 @@ export default Vue.extend({
}
this.book.context = this.context
this.contextName = (await (this.$komgaReadLists.getOneReadList(this.context.id))).name
} else {
this.context = {
origin: ContextOrigin.SERIES,
id: this.book.seriesId,
}
}
// Get siblings depending on origin
if (this?.context.origin === ContextOrigin.SERIES) {
this.siblings = (await this.$komgaSeries.getBooks(this.book.seriesId, { unpaged: true } as PageRequest)).content
} else if (this.context.origin === ContextOrigin.READLIST) {
if (this?.context.origin === ContextOrigin.READLIST) {
this.siblings = (await this.$komgaReadLists.getBooks(this.context.id, { unpaged: true } as PageRequest)).content
} else {
this.siblings = (await this.$komgaSeries.getBooks(this.book.seriesId, { unpaged: true } as PageRequest)).content
}
this.readLists = await this.$komgaBooks.getReadLists(this.bookId)
@ -354,19 +349,19 @@ export default Vue.extend({
}
try {
if (this?.context.origin === ContextOrigin.SERIES) {
this.siblingNext = await this.$komgaBooks.getBookSiblingNext(bookId)
} else if (this.context.origin === ContextOrigin.READLIST) {
if (this?.context.origin === ContextOrigin.READLIST) {
this.siblingNext = await this.$komgaReadLists.getBookSiblingNext(this.context.id, bookId)
} else {
this.siblingNext = await this.$komgaBooks.getBookSiblingNext(bookId)
}
} catch (e) {
this.siblingNext = {} as BookDto
}
try {
if (this?.context.origin === ContextOrigin.SERIES) {
this.siblingPrevious = await this.$komgaBooks.getBookSiblingPrevious(bookId)
} else if (this.context.origin === ContextOrigin.READLIST) {
if (this?.context.origin === ContextOrigin.READLIST) {
this.siblingPrevious = await this.$komgaReadLists.getBookSiblingPrevious(this.context.id, bookId)
} else {
this.siblingPrevious = await this.$komgaBooks.getBookSiblingPrevious(bookId)
}
} catch (e) {
this.siblingPrevious = {} as BookDto