Ignore fetching current user when logged out

This commit is contained in:
Kimmo Puputti 2017-04-20 14:35:01 +03:00
parent f2dd3c9105
commit a99b33e5e8

View file

@ -72,6 +72,13 @@ export const stripeAccountCreateError = e => ({
export const fetchCurrentUser = () =>
(dispatch, getState, sdk) => {
dispatch(usersMeRequest());
const { isAuthenticated } = getState().Auth;
if (!isAuthenticated) {
// Ignore when not logged in, current user should be null
return Promise.resolve({});
}
return sdk.users
.me()
.then(response => {