zahmis 5 лет назад
Родитель
Сommit
1003e1ffdf
2 измененных файлов с 8 добавлено и 8 удалено
  1. 5 7
      src/client/js/components/PageTimeline.jsx
  2. 3 1
      src/server/routes/apiv3/pages.js

+ 5 - 7
src/client/js/components/PageTimeline.jsx

@@ -17,7 +17,6 @@ class PageTimeline extends React.Component {
     super(props);
 
     const { appContainer } = this.props;
-    this.showPages = this.showPages.bind(this);
     this.handlePage = this.handlePage.bind(this);
     this.state = {
       activePage: 1,
@@ -30,17 +29,15 @@ class PageTimeline extends React.Component {
 
   }
 
-  async handlePage(selectedPage) {
-    await this.showPages(selectedPage);
-  }
 
-  async showPages(selectedPage) {
+  async handlePage(selectedPage) {
     const { appContainer, pageContainer } = this.props;
     const { path } = pageContainer.state;
     const limit = this.state.limit;
     const offset = (selectedPage - 1) * limit;
-    const res = await appContainer.apiv3Get('/pages/list', { path, limit, offset });
     const activePage = selectedPage;
+
+    const res = await appContainer.apiv3Get('/pages/list', { path, limit, offset });
     const totalPages = res.data.totalCount;
     const pages = res.data.pages;
     this.setState({
@@ -55,7 +52,8 @@ class PageTimeline extends React.Component {
 
     // initialize GrowiRenderer
     this.growiRenderer = appContainer.getRenderer('timeline');
-    this.showPages(1);
+    this.handlePage(1);
+
   }
 
   render() {

+ 3 - 1
src/server/routes/apiv3/pages.js

@@ -90,9 +90,11 @@ module.exports = (crowi) => {
     const offset = +req.query.offset || 0;
     const queryOptions = { offset, limit };
 
+    console.log(limit);
+
     try {
       const result = await Page.findListWithDescendants(path, req.user, queryOptions);
-
+      console.log(result);
       return res.apiv3(result);
     }
     catch (err) {