Browse Source

fix Authorized Promise render recreating (#987)

* fix Authorized Promise render

* fix style Authorized blank line
pull/845/head
guowenfh 8 years ago
committed by 陈帅
parent
commit
69cb402f9d
  1. 14
      src/components/Authorized/PromiseRender.js

14
src/components/Authorized/PromiseRender.js

@ -6,9 +6,17 @@ export default class PromiseRender extends React.PureComponent {
component: null,
};
componentDidMount() {
const ok = this.checkIsInstantiation(this.props.ok);
const error = this.checkIsInstantiation(this.props.error);
this.props.promise
this.setRenderComponent(this.props);
}
componentWillReceiveProps(nextProps) {
// new Props enter
this.setRenderComponent(nextProps);
}
// set render Component : ok or error
setRenderComponent(props) {
const ok = this.checkIsInstantiation(props.ok);
const error = this.checkIsInstantiation(props.error);
props.promise
.then(() => {
this.setState({
component: ok,

Loading…
Cancel
Save