Fix pagination. Closes #17
This commit is contained in:
parent
d8a7d4f66a
commit
4e12da3a22
@ -64,10 +64,11 @@ export default function (action, requestType, successType, failureType) {
|
||||
* @param pageNumber Number of the page that was fetched.
|
||||
*/
|
||||
const fetchPaginatedItemsSuccess = function (jsonData, pageNumber, limit) {
|
||||
const totalCount = jsonData.totalCount;
|
||||
jsonData = _normalizeAPIResponse(jsonData);
|
||||
|
||||
// Compute the total number of pages
|
||||
const nPages = Math.ceil(jsonData.result[itemName].length / limit);
|
||||
const nPages = Math.ceil(totalCount / limit);
|
||||
|
||||
// Return success actions
|
||||
return [
|
||||
|
@ -104,7 +104,6 @@ button.toggle {
|
||||
*/
|
||||
.main-panel {
|
||||
padding: $mainPadding;
|
||||
z-index: -10;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -134,6 +133,10 @@ button.toggle {
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.main-panel {
|
||||
z-index: -10;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
position: static;
|
||||
}
|
||||
|
@ -36,6 +36,9 @@ class AlbumsPageIntl extends Component {
|
||||
const currentPage = parseInt(this.props.location.query.page) || 1;
|
||||
const nextPage = parseInt(nextProps.location.query.page) || 1;
|
||||
if (currentPage != nextPage) {
|
||||
// Unload data on page change
|
||||
this.props.actions.clearPaginatedResults();
|
||||
// Load new data
|
||||
this.props.actions.loadAlbums({pageNumber: nextPage});
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,9 @@ class ArtistsPageIntl extends Component {
|
||||
const currentPage = parseInt(this.props.location.query.page) || 1;
|
||||
const nextPage = parseInt(nextProps.location.query.page) || 1;
|
||||
if (currentPage != nextPage) {
|
||||
// Unload data on page change
|
||||
this.props.actions.clearPaginatedResults();
|
||||
// Load new data
|
||||
this.props.actions.loadPaginatedArtists({pageNumber: nextPage});
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,9 @@ class SongsPageIntl extends Component {
|
||||
const currentPage = parseInt(this.props.location.query.page) || 1;
|
||||
const nextPage = parseInt(nextProps.location.query.page) || 1;
|
||||
if (currentPage != nextPage) {
|
||||
// Unload data on page change
|
||||
this.props.actions.clearPaginatedResults();
|
||||
// Load new data
|
||||
this.props.actions.loadPaginatedSongs({pageNumber: nextPage});
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user