Prettier code cleanup for PR #273

This commit is contained in:
Michael Shamoon 2022-03-11 12:00:31 -08:00
parent eb55f5655f
commit e41d75c374
2 changed files with 16 additions and 13 deletions

View File

@ -433,13 +433,17 @@ export class DocumentDetailComponent
}
nextDoc() {
this.documentListViewService.getNext(this.document.id).subscribe((nextDocId: number) => {
this.documentListViewService
.getNext(this.document.id)
.subscribe((nextDocId: number) => {
this.router.navigate(['documents', nextDocId])
})
}
previousDoc () {
this.documentListViewService.getPrevious(this.document.id).subscribe((prevDocId: number) => {
previousDoc() {
this.documentListViewService
.getPrevious(this.document.id)
.subscribe((prevDocId: number) => {
this.router.navigate(['documents', prevDocId])
})
}

View File

@ -282,7 +282,7 @@ export class DocumentListViewService {
hasPrevious(doc: number) {
if (this.documents) {
let index = this.documents.findIndex(d => d.id == doc)
let index = this.documents.findIndex((d) => d.id == doc)
return index != -1 && !(index == 0 && this.currentPage == 1)
}
}
@ -311,13 +311,12 @@ export class DocumentListViewService {
}
getPrevious(currentDocId: number): Observable<number> {
return new Observable(prevDocId => {
return new Observable((prevDocId) => {
if (this.documents != null) {
let index = this.documents.findIndex(d => d.id == currentDocId)
let index = this.documents.findIndex((d) => d.id == currentDocId)
if (index != 0) {
prevDocId.next(this.documents[index-1].id)
prevDocId.next(this.documents[index - 1].id)
prevDocId.complete()
} else if (this.currentPage > 1) {
this.currentPage -= 1