mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 18:11:40 -05:00
fix daily view pagination
This commit is contained in:
parent
33e46fc6a9
commit
94b514675f
1 changed files with 11 additions and 7 deletions
|
@ -26,14 +26,18 @@ class PostsDailyList extends Component{
|
|||
loadMoreDays(e) {
|
||||
e.preventDefault();
|
||||
const numberOfDays = getSetting('numberOfDays', 5);
|
||||
const loadMoreBefore = moment(this.state.after, 'YYYY-MM-DD').subtract(1, 'days').format('YYYY-MM-DD');
|
||||
|
||||
/*
|
||||
note: loadMoreBefore is used when doing incremental loading,
|
||||
but we're not doing that anymore so we only need to change 'after'
|
||||
*/
|
||||
|
||||
// const loadMoreBefore = moment(this.state.after, 'YYYY-MM-DD').subtract(1, 'days').format('YYYY-MM-DD');
|
||||
const loadMoreAfter = moment(this.state.after, 'YYYY-MM-DD').subtract(numberOfDays, 'days').format('YYYY-MM-DD');
|
||||
this.props.loadMore({
|
||||
terms: {
|
||||
view: 'top',
|
||||
before: loadMoreBefore,
|
||||
after: loadMoreAfter,
|
||||
}
|
||||
...this.props.terms,
|
||||
// before: loadMoreBefore,
|
||||
after: loadMoreAfter,
|
||||
});
|
||||
this.setState({
|
||||
days: this.state.days + this.props.increment,
|
||||
|
@ -59,7 +63,7 @@ class PostsDailyList extends Component{
|
|||
return (
|
||||
<div className="posts-daily">
|
||||
<Components.PostsListHeader />
|
||||
{postsByDates.map((day, index) => <Components.PostsDay key={index} number={index} {...day} />)}
|
||||
{postsByDates.map((day, index) => <Components.PostsDay key={index} number={index} {...day} loading={true} />)}
|
||||
<a className="posts-load-more-days" onClick={this.loadMoreDays}><FormattedMessage id="posts.load_more_days"/></a>
|
||||
</div>
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue