Humanize validation errors returned on registration
This commit is contained in:
parent
3fa9b39150
commit
822559afd8
3 changed files with 22 additions and 6 deletions
|
@ -1,9 +1,10 @@
|
|||
import oauthApi from '../../services/new_api/oauth.js'
|
||||
import { humanizeErrors } from '../../modules/errors'
|
||||
|
||||
const registration = {
|
||||
data: () => ({
|
||||
user: {},
|
||||
error: false,
|
||||
errors: [],
|
||||
registering: false
|
||||
}),
|
||||
created () {
|
||||
|
@ -37,7 +38,8 @@ const registration = {
|
|||
app,
|
||||
instance: data.instance,
|
||||
username: this.user.username,
|
||||
password: this.user.password})
|
||||
password: this.user.password
|
||||
})
|
||||
.then((result) => {
|
||||
this.$store.commit('setToken', result.access_token)
|
||||
this.$store.dispatch('loginUser', result.access_token)
|
||||
|
@ -47,10 +49,10 @@ const registration = {
|
|||
} else {
|
||||
this.registering = false
|
||||
response.json().then((data) => {
|
||||
this.error = data.error
|
||||
this.errors = humanizeErrors(JSON.parse(data.error))
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue