Так что я пытаюсь загрузить клиентскую панель управления или админдаш, основываясь на том, кто входит в систему. Это мой первый раз, когда я касаюсь Vue, поэтому я не уверен на 100%, что это вообще возможно, но я подумал, что кто-то знал это были бы вы, ребята, здесь. Итак, вот мой код:
export default {
data () {
return {
model: {
email: '',
password: '',
},
modelValidations: {
email: {
required: true,
email: true
},
password: {
required: true,
min: 5
}
},
}
},
methods: {
getError(fieldName) {
return this.errors.first(fieldName)
},
validate() {
let login = this;
this.$auth.login({
params: {
email: login.model.email,
password: login.model.password
},
success: function (response){
console.log(response);
let id = response.data.userinfo.id;
},
error: function (error) {
console.log(error);
},
// rememberMe: true,
// fetchUser: true,
}).then(function(id) {
if (id ==1) {
this.$router.push('/admindashboard');
} else {
this.$router.push('/clientdashboard');
}
});
}
}
}