Tidy up pagination in Api::ProductsController#overridable and Angular PagedFetcher service

Refactors away some unnecessary mess and unblocks the last remaining issue in upgrading the Kaminari gem (deprecated calls to #num_pages method)
This commit is contained in:
Matt-Yorkley
2021-01-05 18:55:22 +00:00
parent 47f9a3f08a
commit 4bb2653306
2 changed files with 5 additions and 8 deletions

View File

@@ -16,7 +16,7 @@ angular.module("admin.indexUtils").factory "PagedFetcher", (dataFetcher) ->
fetchPages: (url, page, pageCallback) ->
dataFetcher(@urlForPage(url, page)).then (data) =>
@page++
@last_page = data.pages
@last_page = data.pagination.pages
pageCallback(data) if pageCallback