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

+ 2 - 1
src/client/js/components/PageList.jsx

@@ -25,7 +25,8 @@ const PageList = (props) => {
   }
 
   const updatePageList = useCallback(async() => {
-    const res = await appContainer.apiv3Get('/pages/list', { path, activePage });
+    const page = activePage;
+    const res = await appContainer.apiv3Get('/pages/list', { path, page });
 
     setPages(res.data.pages);
     setIsLoading(true);

+ 2 - 1
src/client/js/components/RecentCreated/RecentCreated.jsx

@@ -34,10 +34,11 @@ class RecentCreated extends React.Component {
 
   async getRecentCreatedList(selectPageNumber) {
     const { appContainer, userId } = this.props;
+    const page = { selectPageNumber };
     // const userId = appContainer.currentUserId;
 
     // pagesList get and pagination calculate
-    const res = await appContainer.apiv3Get(`/users/${userId}/recent`, { selectPageNumber });
+    const res = await appContainer.apiv3Get(`/users/${userId}/recent`, page);
     const { totalCount, pages, limit } = res.data;
 
     this.setState({

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

@@ -87,24 +87,24 @@ module.exports = (crowi) => {
   });
 
   validator.displayList = [
-    query('pageLimitationS').custom((value) => {
+    query('limit').custom((value) => {
       if (value == null) {
         return 10;
       }
       if (value > 100) {
-        throw new Error('You should set less than 100 or not to set pageLimitationS.');
+        throw new Error('You should set less than 100 or not to set limit.');
       }
       return value;
     }),
   ];
 
   router.get('/list', accessTokenParser, loginRequired, validator.displayList, apiV3FormValidator, async(req, res) => {
-    const pageLimitationS = parseInt(req.query.pageLimitationS) || await crowi.configManager.getConfig('crowi', 'customize:showPageLimitationS') || 10;
+    const limit = parseInt(req.query.limit) || await crowi.configManager.getConfig('crowi', 'customize:showPageLimitationS') || 10;
     const { path } = req.query;
-    const selectedPage = req.query.activePage;
-    const offset = (selectedPage - 1) * pageLimitationS;
+    const page = req.query.page;
+    const offset = (page - 1) * limit;
 
-    const queryOptions = { offset, limit: pageLimitationS };
+    const queryOptions = { offset, limit };
 
     try {
       const result = await Page.findListWithDescendants(path, req.user, queryOptions);

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

@@ -106,12 +106,12 @@ module.exports = (crowi) => {
   ];
 
   validator.recentCreatedByUser = [
-    query('pageLimitationM').custom((value) => {
+    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;
     }),
@@ -254,10 +254,10 @@ module.exports = (crowi) => {
       return res.apiv3Err(new ErrorV3('find-user-is-not-found'));
     }
 
-    const pageLimitationM = parseInt(req.query.pageLimitationM) || await crowi.configManager.getConfig('crowi', 'customize:showPageLimitationM') || 30;
-    const selectPageNumber = req.query.selectPageNumber;
-    const offset = (selectPageNumber - 1) * pageLimitationM;
-    const queryOptions = { offset, limit: pageLimitationM };
+    const limit = parseInt(req.query.limit) || await crowi.configManager.getConfig('crowi', 'customize:showPageLimitationM') || 30;
+    const page = req.query.page;
+    const offset = (page - 1) * limit;
+    const queryOptions = { offset, limit };
 
     try {
       const result = await Page.findListByCreator(user, req.user, queryOptions);