[Vuejs]-…mapActions in Vue-TypeScript application cause error

0đź‘Ť

In your AuthModule.store, you should be using getModule to export the store, i.e.:

export const authModuleStore = getModule(AuthModule);

Then, you can simply import authModuleStore directly in your component and reference its methods directly:

import { authModuleStore } from '/path/to/authModule.store';

export default class AuthView extends Vue {
    private email = "";
    private password = "";
    private rememberMe = "";

    public login(user:object) {};

    performLogin() {
        const user = {
            email: this.email,
            password: this.password,
            rememberMe: this.rememberMe
        };
        authModuleStore .login(user)
            .then(() => this.$router.push('/home'))
            .catch(err => console.log(err))
    }
}

Leave a comment