diff --git a/frontend/app/api_client.ts b/frontend/app/api_client.ts index f6bb4dc49..ffc0843cb 100644 --- a/frontend/app/api_client.ts +++ b/frontend/app/api_client.ts @@ -169,6 +169,7 @@ export default class APIClient { path.includes('login') || path.includes('refresh') || path.includes('logout') + || path.includes('reset') ) && window.env.NODE_ENV !== 'development' ) { init.credentials = 'include'; diff --git a/frontend/app/api_middleware.js b/frontend/app/api_middleware.js index 7b3c56e7f..a6ef69108 100644 --- a/frontend/app/api_middleware.js +++ b/frontend/app/api_middleware.js @@ -22,7 +22,7 @@ export default () => (next) => (action) => { } return response.json(); }) - .then((json) => json || {}) // TEMP TODO on server: no empty responces + .then((json) => json || {}) // TEMP TODO on server: no empty responses .then(({ jwt, errors, data }) => { if (errors) { next({ type: FAILURE, errors, data }); @@ -30,7 +30,7 @@ export default () => (next) => (action) => { next({ type: SUCCESS, data, ...rest }); } if (jwt) { - next({ type: UPDATE_JWT, data: jwt }); + next({ type: UPDATE_JWT, data: { jwt } }); } }) .catch(async (e) => { diff --git a/frontend/app/duck/user.js b/frontend/app/duck/user.js index 537518873..3b148becf 100644 --- a/frontend/app/duck/user.js +++ b/frontend/app/duck/user.js @@ -76,13 +76,15 @@ const reducer = (state = initialState, action = {}) => { .set('spotJwt', action.data.spotJwt); case LOGIN.REQUEST: return state.set('loginRequest', { loading: true, errors: [] }); - case RESET_PASSWORD.SUCCESS: case LOGIN.SUCCESS: return state - .set('account', Account({ ...action.data.user })) + .set('account', Account({ ...action.data.data.user })) .set('spotJwt', action.data.spotJwt) - .set('scope', action.data.scope) + .set('scope', action.data.data.scope) .set('loginRequest', { loading: false, errors: [] }); + case RESET_PASSWORD.SUCCESS: + return state + .set('account', Account({ ...action.data.user })) case UPDATE_PASSWORD.REQUEST: case UPDATE_PASSWORD.SUCCESS: return state.set('passwordErrors', List());