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, component: null,
}; };
componentDidMount() { componentDidMount() {
const ok = this.checkIsInstantiation(this.props.ok); this.setRenderComponent(this.props);
const error = this.checkIsInstantiation(this.props.error); }
this.props.promise 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(() => { .then(() => {
this.setState({ this.setState({
component: ok, component: ok,

Loading…
Cancel
Save