afc163 8 lat temu
rodzic
commit
c3dfe2eb7a
1 zmienionych plików z 33 dodań i 33 usunięć
  1. 33 33
      src/components/Authorized/PromiseRender.js

+ 33 - 33
src/components/Authorized/PromiseRender.js

@@ -2,38 +2,38 @@ import React from 'react';
 import { Spin } from 'antd';
 
 export default class PromiseRender extends React.PureComponent {
-    state = {
-      component: false,
-    };
-    async componentDidMount() {
-      this.props.promise
-        .then(() => {
-          this.setState({
-            component: this.props.ok,
-          });
-        })
-        .catch(() => {
-          this.setState({
-            component: this.props.error,
-          });
+  state = {
+    component: false,
+  };
+  async componentDidMount() {
+    this.props.promise
+      .then(() => {
+        this.setState({
+          component: this.props.ok,
         });
-    }
-    render() {
-      const C = this.state.component;
-      return C ? (
-        <C {...this.props} />
-      ) : (
-        <div
-          style={{
-            width: '100%',
-            height: '100%',
-            margin: 'auto',
-            paddingTop: 50,
-            textAlign: 'center',
-          }}
-        >
-          <Spin size="large" />
-        </div>
-      );
-    }
+      })
+      .catch(() => {
+        this.setState({
+          component: this.props.error,
+        });
+      });
+  }
+  render() {
+    const C = this.state.component;
+    return C ? (
+      <C {...this.props} />
+    ) : (
+      <div
+        style={{
+          width: '100%',
+          height: '100%',
+          margin: 'auto',
+          paddingTop: 50,
+          textAlign: 'center',
+        }}
+      >
+        <Spin size="large" />
+      </div>
+    );
+  }
 }