mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Changed the checkUsername methode of the loginAPI to the checkUsername query from apollo.
This commit is contained in:
parent
ef69683cbb
commit
8674e34e59
@ -1,7 +1,7 @@
|
||||
import { configure, extend } from 'vee-validate'
|
||||
// eslint-disable-next-line camelcase
|
||||
import { required, email, min, max, is_not } from 'vee-validate/dist/rules'
|
||||
import loginAPI from './apis/loginAPI'
|
||||
import { checkUsername } from './graphql/queries'
|
||||
|
||||
export const loadAllRules = (i18nCallback) => {
|
||||
configure({
|
||||
@ -51,8 +51,19 @@ export const loadAllRules = (i18nCallback) => {
|
||||
|
||||
extend('gddUsernameUnique', {
|
||||
async validate(value) {
|
||||
const result = await loginAPI.checkUsername(value)
|
||||
return result.result.data.state === 'success'
|
||||
this.$apollo
|
||||
.query({
|
||||
query: checkUsername,
|
||||
variables: {
|
||||
username: value,
|
||||
},
|
||||
})
|
||||
.then((result) => {
|
||||
return result.data.state === 'success'
|
||||
})
|
||||
.catch(() => {
|
||||
return false
|
||||
})
|
||||
},
|
||||
message: (_, values) => i18nCallback.t('form.validation.usernmae-unique', values),
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user