Grégoire Delattre c5cafacbf1 Update everything to work with the new router
By the way, remove the router state from redux.
2019-05-19 02:31:25 +02:00

39 lines
1.0 KiB
JavaScript

import React from "react"
import PropTypes from "prop-types"
import { connect } from "react-redux"
import { Redirect, Link } from "react-router-dom"
const mapStateToProps = (state) => ({
isActivated: state.userStore.get("isActivated"),
isLogged: state.userStore.get("isLogged"),
});
const UserActivation = (props) => {
if (!props.isLogged) {
return (<Redirect to="/users/login"/>);
}
if (props.isActivated) {
return (<Redirect to="/"/>);
}
return (
<div className="container">
<div className="content-fluid">
<div className="col-md-8 col-md-offset-2 col-xs-12">
<h2>Waiting for activation</h2>
<hr />
<h3>Hang tight! Your user will soon be activated by the administrators of this site.</h3>
<Link to="/users/logout">Logout</Link>
</div>
</div>
</div>
);
}
UserActivation.propTypes = {
isActivated: PropTypes.bool.isRequired,
isLogged: PropTypes.bool.isRequired,
};
export default connect(mapStateToProps)(UserActivation);