Skip to content

Commit 9855ff5

Browse files
committed
feat: provide support for pagination
1 parent cd92237 commit 9855ff5

File tree

5 files changed

+14
-604
lines changed

5 files changed

+14
-604
lines changed

app/controllers/me/pending-invites.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ import { reads } from 'macro-decorators';
66
import { pagination } from '../../utils/pagination';
77

88
export default class PendingInvitesController extends Controller {
9-
queryParams = ['page'];
9+
queryParams = ['page', 'per_page'];
1010
@tracked page = '1';
11+
@tracked per_page = 10;
1112

1213
@reads('model.meta.total') totalItems;
1314
@pagination() pagination;

app/routes/me/pending-invites.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default class PendingInvitesRoute extends AuthenticatedRoute {
99
page: { refreshModel: true },
1010
};
1111

12-
model() {
13-
return this.store.findAll('crate-owner-invite');
12+
model(params) {
13+
return this.store.query('crate-owner-invite', params);
1414
}
1515
}

app/utils/pagination.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ const VIEWABLE_PAGES = 9;
55
export function pagination() {
66
return macro(function () {
77
let { page, per_page: perPage, totalItems } = this;
8+
console.log({
9+
page,
10+
perPage,
11+
totalItems,
12+
});
813
return _pagination(page, perPage, totalItems);
914
});
1015
}

0 commit comments

Comments
 (0)