1

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 
    }
}

1 Answer 1

1

Just dispatch logout() right after the SESSIONTIMEOUT action.

  export function sessionTimeOut(){
        return (dispatch) => {
        dispatch({
            type: ACTIONTYPES.SESSIONTIMEOUT
        });
        dispatch(logout());
        } 
    }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.