Skip to content

Instantly share code, notes, and snippets.

@khanghoang
Last active April 20, 2016 04:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khanghoang/b4cda45e25c11ab2ef871ac42708aefc to your computer and use it in GitHub Desktop.
Save khanghoang/b4cda45e25c11ab2ef871ac42708aefc to your computer and use it in GitHub Desktop.
const initialLoadRequest = (dispatch) => {
const fetchForm = fetchLoginForm;
const sessionStatus = getSessionStatus;
return Promise.props({
form: (() => {
const loginFormAction = fetchForm();
dispatch(loginFormAction);
return loginFormAction.promise;
})(),
isUserLoggedIn: (() => {
const sessionAction = sessionStatus()
dispatch(sessionAction);
return sessionAction.promise;
})()
});
}
export function initialLoad () {
return dispatch => {
return dispatch({
types: ['INITIAL_LOADING', 'INITIAL_LOADING_SUCCEEDED', 'INITIAL_LOADING_FAILED'],
promise: initialLoadRequest(dispatch)
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment