diff options
Diffstat (limited to 'animism-align/frontend/app/views/auth/auth.actions.js')
| -rw-r--r-- | animism-align/frontend/app/views/auth/auth.actions.js | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/animism-align/frontend/app/views/auth/auth.actions.js b/animism-align/frontend/app/views/auth/auth.actions.js index fc2a2aa..7eabacc 100644 --- a/animism-align/frontend/app/views/auth/auth.actions.js +++ b/animism-align/frontend/app/views/auth/auth.actions.js @@ -20,10 +20,10 @@ export const login = data => dispatch => ( }) .then(req => req.json()) .then(res => { - if (!res.access_token) { + if (!res.token) { throw new Error(res.description) } - session.set('access_token', res.access_token) + session.set('access_token', res.token) load_access_token()(dispatch) }) ) @@ -32,8 +32,7 @@ export const load_access_token = () => dispatch => { const access_token = session.get('access_token') || null if (access_token) { const creds = jsonwebtoken.decode(access_token) - const user_id = creds.identity - return dispatch({ type: types.auth.logged_in, user_id }) + return dispatch({ type: types.auth.logged_in, user: creds.sub }) } else { return dispatch({ type: types.auth.logged_out }) } |
