Reputation: 815
I have a redux actions for sessiontimeout and logout. When Sessiontimeout called, Internally calling the logout function.
It did not work also SESSIONTIMEOUT
action type not dispatched.
How I suppose to call logout in Sessiontimeout and dispatch both SESSIONTIMEOUT
and LOGOUT
export function sessionTimeOut(){
return (dispatch) => {
dispatch({
type: ACTIONTYPES.SESSIONTIMEOUT
})
}
logout()
}
export function logout(){
history.push('/')
return {
type: ACTIONTYPES.LOGOUT
}
}
Upvotes: 1
Views: 48
Reputation: 2087
Just dispatch logout()
right after the SESSIONTIMEOUT
action.
export function sessionTimeOut(){
return (dispatch) => {
dispatch({
type: ACTIONTYPES.SESSIONTIMEOUT
});
dispatch(logout());
}
}
Upvotes: 1