Phyks (Lucas Verney)
40f6223bd0
* Keep track of pagination in the store * Use Immutable in reducers * Finish i18n, every available strings are now translated in English and French * Add a loading indicator * Premises of API error handling * Better locale negotiation
15 lines
488 B
JavaScript
15 lines
488 B
JavaScript
export function buildPaginationObject(location, currentPage, nPages, goToPageAction) {
|
|
const buildLinkToPage = function (pageNumber) {
|
|
return {
|
|
pathname: location.pathname,
|
|
query: Object.assign({}, location.query, { page: pageNumber })
|
|
};
|
|
};
|
|
return {
|
|
currentPage: currentPage,
|
|
nPages: nPages,
|
|
goToPage: pageNumber => goToPageAction(buildLinkToPage(pageNumber)),
|
|
buildLinkToPage: buildLinkToPage
|
|
};
|
|
}
|