diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2021-03-05 23:33:50 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2021-03-05 23:33:50 +0100 |
| commit | f6e6b1edbbb68bf6bf93a10deebd4cd55ffaff0f (patch) | |
| tree | bb44de81746cfd088bfab49247b9ec8508bb4605 /animism-align/frontend/app/views/auth/auth.actions.js | |
| parent | 6726fa9fe050aa47ff7f537b91705372e290f501 (diff) | |
use other login validator thingie
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 }) } |
