zahmis 5 lat temu
rodzic
commit
6f6154cb14
1 zmienionych plików z 7 dodań i 5 usunięć
  1. 7 5
      src/client/js/components/PageAttachment.jsx

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

@@ -17,17 +17,15 @@ class PageAttachment extends React.Component {
     const { appContainer } = this.props;
     this.showPages = this.showPages.bind(this);
     this.handlePage = this.handlePage.bind(this);
-
     this.state = {
+      activePage: 1,
+      totalPages: 0,
+      limit: appContainer.getConfig().recentCreatedLimit,
       attachments: [],
       inUse: {},
       attachmentToDelete: null,
       deleting: false,
       deleteError: '',
-      activePage: 1,
-      totalPages: 0,
-      limit: appContainer.getConfig().recentCreatedLimit,
-
     };
 
     this.onAttachmentDeleteClicked = this.onAttachmentDeleteClicked.bind(this);
@@ -59,6 +57,8 @@ class PageAttachment extends React.Component {
           inUse,
         });
       });
+
+    this.showPages(1);
   }
 
   async handlePage(selectedPage) {
@@ -70,6 +70,7 @@ class PageAttachment extends React.Component {
     const { path } = pageContainer.state;
     const limit = this.state.limit;
     const offset = (selectedPage - 1) * limit;
+    // ここが違う。エンドポイントは attachment.js apiv3 だが、そこに pagination がないためこの機能が実装できない。先にそちらを行う。
     const res = await appContainer.apiv3Get('/pages/list', { path, limit, offset });
     const activePage = selectedPage;
     const totalPages = res.data.totalCount;
@@ -123,6 +124,7 @@ class PageAttachment extends React.Component {
     return this.props.appContainer.currentUser != null;
   }
 
+
   render() {
     let deleteAttachmentModal = '';
     if (this.isUserLoggedIn()) {