소스 검색

refactoring

zahmis 5 년 전
부모
커밋
e26c15aa5c
1개의 변경된 파일10개의 추가작업 그리고 12개의 파일을 삭제
  1. 10 12
      src/client/js/components/PageAttachment.jsx

+ 10 - 12
src/client/js/components/PageAttachment.jsx

@@ -32,20 +32,18 @@ class PageAttachment extends React.Component {
       return;
     }
 
-    await this.props.appContainer.apiv3Get('/attachment/list', { pageId })
-      .then((res) => {
-        const attachments = res.data.attachments;
-        const inUse = {};
+    const res = await this.props.appContainer.apiv3Get('/attachment/list', { pageId });
+    const attachments = res.data.attachments;
+    const inUse = {};
 
-        for (const attachment of attachments) {
-          inUse[attachment._id] = this.checkIfFileInUse(attachment);
-        }
+    for (const attachment of attachments) {
+      inUse[attachment._id] = this.checkIfFileInUse(attachment);
+    }
 
-        this.setState({
-          attachments,
-          inUse,
-        });
-      });
+    this.setState({
+      attachments,
+      inUse,
+    });
   }
 
   checkIfFileInUse(attachment) {