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

@ -105,7 +105,7 @@
import {mapState} from 'vuex'
import {HTTPFactory} from '@/http-common'
import {ERROR_MESSAGE, LOADING} from '@/store/mutation-types'
import {LOADING} from '@/store/mutation-types'
import legal from '../../components/misc/legal'
import ApiConfig from '@/components/misc/api-config.vue'
import {getErrorText} from '@/message'
@ -121,6 +121,7 @@ export default {
return {
confirmedEmailSuccess: false,
hasApiUrl: false,
errorMessage: '',
}
},
beforeMount() {
@ -138,7 +139,7 @@ export default {
})
.catch(e => {
cancel()
this.$store.commit(ERROR_MESSAGE, e.response.data.message)
this.errorMessage = e.response.data.message
})
}
@ -170,7 +171,6 @@ export default {
...mapState({
registrationEnabled: state => state.config.registrationEnabled,
loading: LOADING,
errorMessage: ERROR_MESSAGE,
needsTotpPasscode: state => state.auth.needsTotpPasscode,
authenticated: state => state.auth.authenticated,
localAuthEnabled: state => state.config.auth.local.enabled,
@ -189,7 +189,7 @@ export default {
},
async submit() {
this.$store.commit(ERROR_MESSAGE, '')
this.errorMessage = ''
// Some browsers prevent Vue bindings from working with autofilled values.
// To work around this, we're manually getting the values here instead of relying on vue bindings.
// For more info, see https://kolaente.dev/vikunja/frontend/issues/78
@ -211,12 +211,7 @@ export default {
}
const err = getErrorText(e)
if (typeof err[1] !== 'undefined') {
this.$store.commit(ERROR_MESSAGE, err[1])
return
}
this.$store.commit(ERROR_MESSAGE, err[0])
this.errorMessage = typeof err[1] !== 'undefined' ? err[1] : err[0]
}
},