false positive on user signed in

This commit is contained in:
Riley Davis
2016-11-29 15:58:05 -07:00
parent 257ecd3328
commit 3e86bfdceb
+7 -1
View File
@@ -123,6 +123,12 @@ const checkLoginFailure = error => ({type: actions.CHECK_LOGIN_FAILURE, error});
export const checkLogin = () => dispatch => {
dispatch(checkLoginRequest());
coralApi('/auth')
.then(user => dispatch(checkLoginSuccess(user)))
.then(user => {
if (!user) {
throw new Error('not logged in');
}
dispatch(checkLoginSuccess(user));
})
.catch(error => dispatch(checkLoginFailure(error)));
};