1
0

feat: keep errorMessage local (#865)

Co-authored-by: Dominik Pschenitschni <mail@celement.de>
Co-authored-by: kolaente <k@knt.li>
Co-authored-by: konrad <k@knt.li>
Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/865
Co-authored-by: dpschen <dpschen@noreply.kolaente.de>
Co-committed-by: dpschen <dpschen@noreply.kolaente.de>
This commit is contained in:
dpschen
2021-10-17 19:38:30 +00:00
committed by konrad
parent 1fc857d9a2
commit 0a1d0084e2
6 changed files with 31 additions and 41 deletions

View File

@ -1,5 +1,5 @@
import {HTTPFactory} from '@/http-common'
import {ERROR_MESSAGE, LOADING} from '../mutation-types'
import {LOADING} from '../mutation-types'
import UserModel from '../../models/user'
import {getToken, refreshToken, removeToken, saveToken} from '@/helpers/auth'
@ -128,8 +128,8 @@ export default {
})
return ctx.dispatch('login', credentials)
} catch(e) {
if (e.response && e.response.data && e.response.data.message) {
ctx.commit(ERROR_MESSAGE, e.response.data.message, {root: true})
if (e.response?.data?.message) {
throw e.response.data
}
throw e