Commit f98fd1ae authored by Mike Greiling's avatar Mike Greiling

Prefer nextPage over totalPages as later is omitted in some contexts

parent 76a272ba
import axios from './axios_utils';
import { normalizeHeaders } from './common_utils';
import { normalizeHeaders, parseIntPagination } from './common_utils';
// This is used in the select2 config to replace jQuery.ajax with axios
export const select2AxiosTransport = (params) => {
......@@ -9,9 +9,8 @@ export const select2AxiosTransport = (params) => {
.then((res) => {
const results = res.data || [];
const headers = normalizeHeaders(res.headers);
const currentPage = parseInt(headers['X-PAGE'], 10) || 0;
const totalPages = parseInt(headers['X-TOTAL-PAGES'], 10) || 0;
const more = currentPage < totalPages;
const pagination = parseIntPagination(headers);
const more = pagination.nextPage > pagination.page;
params.success({
results,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment