Change: ブックマーク分類のページネーション (#123)

* Change: ブックマーク分類の投稿一覧のページネーション対応

* Fix: `console.dir`を削除(なぜ警告出ない)
This commit is contained in:
KMY(雪あすか) 2023-10-16 13:09:56 +09:00 committed by GitHub
parent d0f0dd723c
commit 86a8b260e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View file

@ -213,9 +213,10 @@ export const deleteBookmarkCategoryFail = (id, error) => ({
export const fetchBookmarkCategoryStatuses = bookmarkCategoryId => (dispatch, getState) => {
dispatch(fetchBookmarkCategoryStatusesRequest(bookmarkCategoryId));
api(getState).get(`/api/v1/bookmark_categories/${bookmarkCategoryId}/statuses`, { params: { limit: 0 } }).then(({ data }) => {
dispatch(importFetchedStatuses(data));
dispatch(fetchBookmarkCategoryStatusesSuccess(bookmarkCategoryId, data));
api(getState).get(`/api/v1/bookmark_categories/${bookmarkCategoryId}/statuses`).then((response) => {
const next = getLinks(response).refs.find(link => link.rel === 'next');
dispatch(importFetchedStatuses(response.data));
dispatch(fetchBookmarkCategoryStatusesSuccess(bookmarkCategoryId, response.data, next ? next.uri : null));
}).catch(err => dispatch(fetchBookmarkCategoryStatusesFail(bookmarkCategoryId, err)));
};

View file

@ -113,7 +113,7 @@ class BookmarkCategoryStatuses extends ImmutablePureComponent {
};
handleLoadMore = debounce(() => {
this.props.dispatch(expandBookmarkCategoryStatuses());
this.props.dispatch(expandBookmarkCategoryStatuses(this.props.params.id));
}, 300, { leading: true });
render () {