A
A
asd dsa2019-02-05 13:19:52
JavaScript
asd dsa, 2019-02-05 13:19:52

What types to add to variables?

What is the correct type to set the variables: login, getUser, loginForm and the return value from the submitForm method?

@Action('login', {namespace: 'auth'})
    public login: any;
    @Action('getUser', {namespace: 'user'})
    public getUser: any;

public submitForm(formName: string): any {
      const loginForm: any = this.$refs[formName];
      console.log(typeof(this.$refs[formName]));
      loginForm.validate((valid: boolean) => {
        if (valid) {
          return this.login(this.form)
            .then(this.getUser)
            .then(this.redirectUser)
            .then(() => this.$message({
              type: 'success',
              message: Logged in as ${this.currentUser.firstName} ${this.currentUser.lastName}!,
              showClose: true,
              duration: 1500,
            }))
            .catch((error: Error) => {
              this.$message({
                type: 'error',
                message: error.message,
                showClose: true,
                duration: 2000,
              });
              loginForm.resetFields();
            });
        }
        return false;
      });
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Klein Maximus, 2019-02-13
@kleinmaximus

See vue/types/vue.d.ts
loginForm - Vue | element | vue[] | Element[]
And what do you have actions in the store return, see for yourself or add the code of the storage module.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question