Extracting token from cookie if safari

This commit is contained in:
Belen Curcio
2017-05-25 18:30:01 -03:00
parent 460f3f292b
commit cbf7cc67f4
3 changed files with 37 additions and 7 deletions
+5 -5
View File
@@ -112,10 +112,8 @@ const signInFailure = (error) => ({
//==============================================================================
export const handleAuthToken = (token) => (dispatch) => {
if (!browser || browser.name !== 'Safari') {
Storage.setItem('exp', jwtDecode(token).exp);
Storage.setItem('token', token);
}
Storage.setItem('exp', jwtDecode(token).exp);
Storage.setItem('token', token);
dispatch({type: 'HANDLE_AUTH_TOKEN'});
};
@@ -129,7 +127,9 @@ export const fetchSignIn = (formData) => {
return coralApi('/auth/local', {method: 'POST', body: formData})
.then(({token}) => {
dispatch(handleAuthToken(token));
if (!browser || browser.name !== 'Safari') {
dispatch(handleAuthToken(token));
}
dispatch(hideSignInDialog());
})
.catch((error) => {