From f6e6b1edbbb68bf6bf93a10deebd4cd55ffaff0f Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 5 Mar 2021 23:33:50 +0100 Subject: use other login validator thingie --- animism-align/frontend/app/views/auth/auth.actions.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'animism-align/frontend/app/views/auth/auth.actions.js') 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 }) } -- cgit v1.2.3-70-g09d2