itizawa 6 лет назад
Родитель
Сommit
0acab5a324

+ 0 - 10
src/client/js/components/Admin/Customize/CustomizeHighlightSetting.jsx

@@ -24,16 +24,6 @@ class CustomizeHighlightSetting extends React.Component {
     this.onClickSubmit = this.onClickSubmit.bind(this);
   }
 
-  async componentDidMount() {
-    try {
-      await this.props.adminCustomizeContainer.fetchHighLightTheme();
-    }
-    catch (err) {
-      toastError(err);
-      logger.error(err);
-    }
-  }
-
   async onClickSubmit() {
     const { t, adminCustomizeContainer } = this.props;
 

+ 15 - 1
src/client/js/services/AdminCustomizeContainer.js

@@ -1,5 +1,12 @@
 import { Container } from 'unstated';
 
+import loggerFactory from '@alias/logger';
+
+import { toastError } from '../util/apiNotification';
+
+// eslint-disable-next-line no-unused-vars
+const logger = loggerFactory('growi:services:AdminCustomizeContainer');
+
 /**
  * Service container for admin customize setting page (Customize.jsx)
  * @extends {Container} unstated Container
@@ -40,8 +47,15 @@ export default class AdminCustomizeContainer extends Container {
   /**
    * retrieve customize data
    */
-  init() {
+  async init() {
     // TODO GW-575 fetch data with apiV3
+    try {
+      await this.fetchHighLightTheme();
+    }
+    catch (err) {
+      logger.error(err);
+      toastError(new Error('Failed to fetch data'));
+    }
   }
 
   /**