loginCheckUri: string = 'http://127.0.0.1:8000/api/login_check';
login(username:string,password:string) {
let headers = new Headers();
headers.append('content-type', 'application/x-www-form-urlencoded');
let body = new URLSearchParams();
body.set('username', username);
body.set('password', password);
return new Promise((resolve, reject) => {
this.http.post(this.loginCheckUri, body, { headers: headers }).subscribe(res => {
resolve(res.json());
console.log('success');
}, (err) => {
reject(err);
console.log('error: ',err);
});
})
}
signIn() {
this.authProvider.login(this.user.email,this.user.password)
.then((res) => { this.navCtrl.push(HomePage); })
.catch((err)=>{console.log('error');});
}
我成功回复,状态代码:200 以及令牌但是 我在控制台出错了,