- this.loadingPage[page] = true
- const observable = this.getVideosObservable(page)
-
- observable.subscribe(
- ({ videos, totalVideos }) => {
- this.loadingPage[page] = false
-
- if (this.firstLoadedPage === undefined || this.firstLoadedPage > page) this.firstLoadedPage = page
-
- // Paging is too high, return to the first one
- if (this.pagination.currentPage > 1 && totalVideos <= ((this.pagination.currentPage - 1) * this.pagination.itemsPerPage)) {
- this.pagination.currentPage = 1
- this.setNewRouteParams()
- return this.reloadVideos()
- }