zahmis 5 лет назад
Родитель
Сommit
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) {