FitTrackee/mpwo_client/src/components/User/Logout.jsx

32 lines
598 B
React
Raw Normal View History

import React from 'react'
import { connect } from 'react-redux'
import { Link } from 'react-router-dom'
2017-12-31 18:43:24 +01:00
import { logout } from '../../actions/index'
class Logout extends React.Component {
componentDidMount() {
this.props.UserLogout()
}
render() {
return (
<div>
2018-01-01 11:10:39 +01:00
<p className="App-center">
You are now logged out.
Click <Link to="/login">here</Link> to log back in.</p>
</div>
)
}
}
export default connect(
state => ({
user: state.user,
}),
dispatch => ({
UserLogout: () => {
dispatch(logout())
}
})
)(Logout)