Skip to content
Snippets Groups Projects

Registration form: Client side validation + better display of server validation errors

Merged Vlad Mikhailov requested to merge raeno/pleroma-fe:better_errors_on_registration into develop
1 unresolved thread
3 files
+ 22
6
Compare changes
  • Side-by-side
  • Inline
Files
3
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