zahmis 5 лет назад
Родитель
Сommit
fa2797b561

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

@@ -23,7 +23,7 @@ class MyBookmarkList extends React.Component {
       pages: [],
       activePage: 1,
       totalPages: 0,
-      pagingLimit: Infinity,
+      pagingLimit: 30,
     };
 
     this.handlePage = this.handlePage.bind(this);
@@ -40,9 +40,10 @@ class MyBookmarkList extends React.Component {
   async getMyBookmarkList(selectPageNumber) {
     const { appContainer } = this.props;
     const userId = appContainer.currentUserId;
+    const page = selectPageNumber;
 
     try {
-      const { data } = await this.props.appContainer.apiv3.get(`/bookmarks/${userId}`, { selectPageNumber });
+      const { data } = await this.props.appContainer.apiv3.get(`/bookmarks/${userId}`, { page });
       if (data.paginationResult == null) {
         throw new Error('data must conclude \'paginateResult\' property.');
       }

+ 6 - 6
src/server/routes/apiv3/bookmarks.js

@@ -144,13 +144,13 @@ module.exports = (crowi) => {
    *                  $ref: '#/components/schemas/Bookmark'
    */
   validator.myBookmarkList = [
-    query('selectPageNumber').isInt({ min: 1 }),
-    query('pageLimitationM').custom((value) => {
+    query('page').isInt({ min: 1 }),
+    query('limit').custom((value) => {
       if (value == null) {
         return 10;
       }
       if (value > 300) {
-        throw new Error('You should set less than 100 or not to set pageLimitationM.');
+        throw new Error('You should set less than 100 or not to set limit.');
       }
       return value;
     }),
@@ -158,8 +158,8 @@ module.exports = (crowi) => {
 
   router.get('/:userId', accessTokenParser, loginRequired, validator.myBookmarkList, apiV3FormValidator, async(req, res) => {
     const { userId } = req.params;
-    const selectPageNumber = req.query.selectPageNumber;
-    const pageLimitationM = parseInt(req.query.pageLimitationM) || await crowi.configManager.getConfig('crowi', 'customize:showPageLimitationM') || 30;
+    const page = req.query.page;
+    const pageLimitationM = parseInt(req.query.limit) || await crowi.configManager.getConfig('crowi', 'customize:showPageLimitationM') || 30;
 
     if (userId == null) {
       return res.apiv3Err('User id is not found or forbidden', 400);
@@ -182,7 +182,7 @@ module.exports = (crowi) => {
               select: User.USER_PUBLIC_FIELDS,
             },
           },
-          page: selectPageNumber,
+          page,
           limit: pageLimitationM,
         },
       );