This is Component File is…
` import CommonForm from '../common/Form.vue'`
export default
{
data() {
return {
}
},
components:{
CommonForm:CommonForm
},
computed:{
...mapGetters({
formData:'getFormObj',
unauthorised:'getUnauthorisedState'
})
},
methods:{
submitLogin() {
this.loginForm(this.formData);
},
...mapActions({
loginForm: 'loginForm'
})
}
}
the action which commits the mutation is.
export const loginForm = ({commit},data) => {
return new Promise((resolve, reject) => {
axios.post('http://localhost:8000/api/login',data).then((response) => {
console.log(response);
commit('logUserIn',response.data.data);
resolve();
this.$router.go('home')
}).catch((error) => {
commit('unAuthorisedUser',{
error:error.response.data
})
})
});
};
The error in chrome console is.