0๐
data(){
return {
loading: false,
form:{
mobile_number: null,
password: null
},
errors: {
mobile_number: null,
password: null,
},
};
},
axios.post('/api/auth/login',this.form)
.then(res => {
User.responseAfterLogin(res)
Toast.fire({
icon: 'success',
title: 'Signed in successfully'
})
this.$router.push({ name: 'DashBoard'});
})
.catch((error) => {
this.loading = false;
this.errors = error.response.data.errors;
Toast.fire({
icon: 'warning',
title: 'Invalid Email or Password'
})
})
.finally(() => {
this.loading = false
})
Source:stackexchange.com