ryuichi-e 5 лет назад
Родитель
Сommit
5338b64dc3
1 измененных файлов с 5 добавлено и 3 удалено
  1. 5 3
      src/client/js/components/MyBookmarkList/MyBookmarkList.jsx

+ 5 - 3
src/client/js/components/MyBookmarkList/MyBookmarkList.jsx

@@ -42,15 +42,17 @@ class MyBookmarkList extends React.Component {
 
     const userId = appContainer.currentUserId;
     const limit = appContainer.getConfig().recentCreatedLimit;
-    /* const offset = (selectPageNumber - 1) * limit; */
+    const offset = (selectPageNumber - 1) * limit;
+    const params = { limit, offset };
 
     try {
-      const response = await this.props.appContainer.apiv3.get('/bookmarks/byUser', { userId });
+      const response = await this.props.appContainer.apiv3.get(`/bookmarks/${userId}`, params);
       const pageList = response.data.pageList;
       const totalPages = pageList.length;
       const activePage = selectPageNumber;
+      const currentPages = pageList.slice((activePage - 1) * limit, activePage * limit);
       this.setState({
-        pages: pageList,
+        pages: currentPages,
         activePage,
         totalPages,
         pagingLimit: limit,