У меня есть CustomerPage, CustomerService и AuthService.
При необходимости передать access_token из AuthService в CustomerService для запроса http-get.
AuthService и CustomerService не работают.
Пожалуйста, помогите мне!
Thnx.
CustomerPage:
this.customerService.getCustomersDashboard()
.subscribe(....)
CustomerService:
getCustomersDashboard(): Observable<any> {
var url = "......";
let authHeader = this.authservice.getAuthHeaders(); // HttpHeader with access_token
return this.http.get(url, { headers: authHeader }).pipe(
map((resp: Response) => {
let response = this.extractData(resp);
return response;
}));
AuthService:
не работает !!!
getAuthHeaders(){
const authtoken = Observable.fromPromise(this.storage.get(`access_token`));
return new HttpHeaders({ 'authorization': authtoken }); // => **not working**
}