diff options
| author | marcin mikołajczak <me@mkljczk.pl> | 2024-01-14 06:23:30 +0000 |
|---|---|---|
| committer | marcin mikołajczak <me@mkljczk.pl> | 2024-01-14 06:23:30 +0000 |
| commit | dbe9da0f09d9471e9a87e564bb18412f937b8542 (patch) | |
| tree | 9e628be15bda940c59131da1d56024ba22cf7973 /src/modules | |
| parent | 6c4c8fe51f0e2c4ce55f5915a2bc5434aef5e5e7 (diff) | |
| parent | ae4e360157234a352f71c90e84b9861ee572472e (diff) | |
Merge branch 'develop' into 'quotes-count'
# Conflicts:
# src/services/api/api.service.js
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/users.js | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/modules/users.js b/src/modules/users.js index 6467d732..b8f49f15 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -250,6 +250,7 @@ export const mutations = { signUpPending (state) { state.signUpPending = true state.signUpErrors = [] + state.signUpNotice = {} }, signUpSuccess (state) { state.signUpPending = false @@ -257,6 +258,12 @@ export const mutations = { signUpFailure (state, errors) { state.signUpPending = false state.signUpErrors = errors + state.signUpNotice = {} + }, + signUpNotice (state, notice) { + state.signUpPending = false + state.signUpErrors = [] + state.signUpNotice = notice } } @@ -287,6 +294,7 @@ export const defaultState = { usersByNameObject: {}, signUpPending: false, signUpErrors: [], + signUpNotice: {}, relationships: {} } @@ -524,9 +532,16 @@ const users = { const data = await rootState.api.backendInteractor.register( { params: { ...userInfo } } ) - store.commit('signUpSuccess') - store.commit('setToken', data.access_token) - store.dispatch('loginUser', data.access_token) + + if (data.access_token) { + store.commit('signUpSuccess') + store.commit('setToken', data.access_token) + store.dispatch('loginUser', data.access_token) + return 'ok' + } else { // Request succeeded, but user cannot login yet. + store.commit('signUpNotice', data) + return 'request_sent' + } } catch (e) { const errors = e.message store.commit('signUpFailure', errors) |
