I was trying to trigger an event after redux state have been updated so I ran a promise .then like this
logoutHandler = (event) => {
console.log("logout Handler")
event.preventDefault()
window.FB.logout()
this.props.LoggedIn(false).then(() => {
this.props.history.replace('/signup');
})
}
Notice this..
this.props.LoggedIn(false).then(() => {
this.props.history.replace('/signup');
})
Where .LoggedIn(false)
is a redux action.
This is throwing an error
Cannot read property 'then' of undefined
This is my redux action
export const LoggedIn = (isLoggedIn) => {
return function (dispatch) {
dispatch({
type: USER_LOGGED_IN ,
payload: isLoggedIn
})
}
}
Question: Can someone tell me what I would be doing wrong here?