所以我刚刚升级到RXJS 6,但是有这个小问题。
getProfile(credentials) {
return new Promise((resolve, reject) => {
this.http.get('admin/userstatus-auth', {credentials}).pipe(
map(res => res))
.subscribe(res => {
resolve(res);
}, (err) => {
reject(err);
});
});
}
因此在这里它表示以下内容:
Argument of type ‘{credentials : any}’ is not assignable to parameter of type ‘{headers?: HttpHeaders }’
…
如果我执行“凭据:HttpHeaders”,则会收到相同的错误
答案 0 :(得分:0)
尝试一下。
getProfile(credentials) {
const params = new HttpParams().set('credentials', credentials);
return new Promise((resolve, reject) => {
this.http.get('admin/userstatus-auth', { params: params }).pipe(
map(res => res))
.subscribe(res => {
resolve(res);
}, (err) => {
reject(err);
});
});
}