@bandito wrote:
Hi
I been trying for the past couple of hours to use the ‘Authorization’ header in my request to the server.
The Angular people (like always <.< ) change the API yet again so RequestOption doesn’t exist on the http module anymore. How can I use the HttpHeaders?
Here is a snippet of my code!
const token = sessionStorage.getItem('token'); if (!token) { setTimeout(() => this.getWeather(), 3000); } const headers = new HttpHeaders({ 'Authorization': `Bearer ${token}` }); const options = { headers: headers }; const host = `http://localhost:5000/weather`; return this.httpClient.get<IApiResponse<IWeather>>(host, options) .pipe( retry(3), catchError(this.handleError) );
Thanks for the help!
PS:
Thank the gods the ionic beta will be Framework agnostic because I am about to trash Angular to hell and stay with Stencil + Ionic or just go/try Vue + ionic.
Posts: 1
Participants: 1