【发布时间】:2019-02-21 16:31:49
【问题描述】:
我正在尝试对用户进行身份验证,但由于 跨域读取阻止 (CORB) 被阻止发出我的 login.ts 代码是
if (this.plugins.isOnline()) {
if (this.wait == true) {
return;
} else if (this.userLogin.email == '' || this.userLogin.password == '') {
this.utility.doToast("Please don't leave any field blank.");
return;
} else {
this.wait = true;
this.auth.login(this.userLogin).subscribe((success) => {
this.wait = false;
console.log(success.successData);
this.credential.setUser(success.successData);
this.plugins.sendTags(success.successData.id)
this.rememberUsertype(success.successData.is_celebrity);
if(success.successData.is_celebrity == '0'){
this.app.getRootNav().setRoot("HomePage");
}
else if(success.successData.is_celebrity == '1'){
this.app.getRootNav().setRoot("DashboardPage");
}
}, (error) => {
console.log(error);
this.wait = false;
if (this.utility.timeOutResponse(error))
this.utility.doToast("The email or password you entered is incorrect.")
})
}
} else {
this.utility.doToast(this.utility.internetConnectionMessage());
}
this.auth.login 函数
login(params) {
console.log(params);
var url = this.constants.API_ENDPOINT + 'login';
var response = this.http.post(url, params, {}).map(res => res.json());
return response;
}
【问题讨论】:
标签: angular ionic-framework ionic2 ionic3