You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
736 B
27 lines
736 B
import { Dispatch } from 'redux'
|
|
import { connect } from 'react-redux'
|
|
import { unauthenticate } from 'src/actions/authentication'
|
|
import { getAuthenticated, getChecked, getAuthenticatedUser } from 'src/selectors/authentication'
|
|
import { AppState } from 'src/types'
|
|
|
|
import Self from './self'
|
|
|
|
const mapStateToProps = (state: AppState) => ({
|
|
checked: getChecked(state),
|
|
authenticated: getAuthenticated(state),
|
|
user: getAuthenticatedUser(state),
|
|
})
|
|
|
|
const mapDispatchToProps = (dispatch: Dispatch) => ({
|
|
logout: async () => {
|
|
localStorage.clear()
|
|
dispatch(unauthenticate())
|
|
|
|
window.location.href = '/'
|
|
},
|
|
})
|
|
|
|
export default connect(
|
|
mapStateToProps,
|
|
mapDispatchToProps
|
|
)(Self)
|