Created
August 16, 2015 20:32
-
-
Save s-petersson/2a7243cc9d0e656f99d0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function loginSuccess (router) { | |
return (dispatch, getState) => { | |
const state = getState(); | |
console.log('test'); | |
let nextPath = state.router.query ? state.router.query.next : '/home'; | |
// TODO: Swap these two, when React 0.14 is released. | |
// dispatch(transitionTo(state.router.query.next)); | |
router.transitionTo(nextPath); | |
}; | |
} | |
export function login (email, password, router) { | |
return { | |
types: [LOGIN, LOGIN_SUCCESS, LOGIN_ERROR], | |
payload: { | |
promise: authenticate(email, password), | |
onSuccessAction: loginSuccess(router) | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment