From db80a367295948877289fac5e2de2d52cac3b0fc Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Thu, 7 May 2015 08:58:04 +0930 Subject: [PATCH] Fix discussion list pagination --- .../core/js/forum/src/components/discussion-list.js | 10 +++++----- framework/core/js/lib/store.js | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/framework/core/js/forum/src/components/discussion-list.js b/framework/core/js/forum/src/components/discussion-list.js index 96de9daf3..14eca9046 100644 --- a/framework/core/js/forum/src/components/discussion-list.js +++ b/framework/core/js/forum/src/components/discussion-list.js @@ -60,23 +60,23 @@ export default class DiscussionList extends Component { return this.props.params.sort === 'replies' ? 'replies' : 'unread'; } - loadResults(start) { + loadResults(offset) { var params = this.params(); - params.start = start; + params.page = {offset}; return app.store.find('discussions', params); } loadMore() { var self = this; this.loading(true); - this.loadResults(this.discussions().length).then((results) => this.parseResults(results, true)); + this.loadResults(this.discussions().length).then((results) => this.parseResults(results)); } - parseResults(results, append) { + parseResults(results) { m.startComputation(); this.loading(false); [].push.apply(this.discussions(), results); - this.moreResults(!!results.meta.moreUrl); + this.moreResults(!!results.payload.links.next); m.endComputation(); return results; } diff --git a/framework/core/js/lib/store.js b/framework/core/js/lib/store.js index 8801504dd..3299699da 100644 --- a/framework/core/js/lib/store.js +++ b/framework/core/js/lib/store.js @@ -7,7 +7,6 @@ export default class Store { pushPayload(payload) { payload.included && payload.included.map(this.pushObject.bind(this)) var result = payload.data instanceof Array ? payload.data.map(this.pushObject.bind(this)) : this.pushObject(payload.data); - result.meta = payload.meta; result.payload = payload; return result; }