[Vuejs]-Vee Validate – Sever side validation and front end validation

0πŸ‘

It turns out apollo client is a promise which isnt resolved so the fix is:

const userResponse = await this.$apollo
        .mutate({
          mutation: CREATE_USER,
          variables: this.newUser
        })
        .then(response => {
          this.isCreating = false  

          const user = response.data.createUser
          
          this.$store.commit('USER_STORE/CREATE_USER', response.data.createUser)
          this.$toast.success('Successfully created new user.')
          this.$router.push({ name: "organisation/users", params: { org_id: this.$route.params.org_id }}, () => {})
        }).catch((error) => {
          this.isCreating = false
          this.$toast.error(error.graphQLErrors[0].extensions.code.message)
          return error.graphQLErrors[0].extensions.code.errors.detail
        })

     
      this.$refs.provider.setErrors(userResponse);

Leave a comment