Improve pagination data in bulk products

This commit is contained in:
Matt-Yorkley
2019-07-25 09:34:50 +01:00
parent 9b0e27a9d1
commit f6d0de1454
2 changed files with 16 additions and 10 deletions

View File

@@ -118,7 +118,15 @@ module Api
each_serializer: Api::Admin::ProductSerializer
)
render text: { products: serializer, pages: products.num_pages }.to_json
render text: {
products: serializer,
pagination: {
results: products.total_count,
pages: products.num_pages,
page: params[:page].to_i,
per_page: params[:per_page].to_i
}
}.to_json
end
end
end