Grégoire Delattre bcadc48d5a Launch prettier with the --fix option
They've changed their default settings, this changes a lot of stuff in
our code base.
2020-04-01 17:55:34 +02:00

27 lines
670 B
JavaScript

import React from "react";
import PropTypes from "prop-types";
import { connect } from "react-redux";
import { Redirect } from "react-router-dom";
import { userLogout } from "../../actions/users";
const mapStateToProps = (state) => ({
isLogged: state.userStore.get("isLogged"),
});
const mapDispatchToProps = { userLogout };
const UserLogout = (props) => {
if (props.isLogged) {
props.userLogout();
}
return <Redirect to="/users/login" />;
};
UserLogout.propTypes = {
isLogged: PropTypes.bool.isRequired,
userLogout: PropTypes.func.isRequired,
history: PropTypes.object,
};
export default connect(mapStateToProps, mapDispatchToProps)(UserLogout);