web: Common: Replaced state to props

This commit is contained in:
Alexey Safronov 2019-11-26 17:47:02 +03:00
parent 8b4731e823
commit e6498718ca

View File

@ -4,27 +4,27 @@ import { PageLayout, Loader } from "asc-web-components";
export class ExternalRedirect extends Component {
constructor(props) {
super();
this.state = {
location: props.to
};
super(props);
}
componentDidMount() {
window.location.replace(this.state.location);
const { to } = this.props;
to && window.location.replace(to);
}
render() {
return <PageLayout
sectionBodyContent={
<Loader className="pageLoader" type="rombs" size={40} />
}
/>
return (
<PageLayout
sectionBodyContent={
<Loader className="pageLoader" type="rombs" size={40} />
}
/>
);
}
}
ExternalRedirect.propTypes = {
to: PropTypes.string
}
};
export default ExternalRedirect;