【发布时间】:2018-10-10 22:35:49
【问题描述】:
所以我尝试根据谁正在登录来加载客户端仪表板或管理仪表板。这是我第一次接触 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');
}
});
}
}
}
【问题讨论】:
-
您目前看到的行为是什么?
标签: javascript ajax vue.js jwt-auth