Skip to content

Commit 4351e2e

Browse files
author
Danilo Otavio Lima Salve
committed
fix(currency): altera envio de token para API de moedas
1 parent 8c67b80 commit 4351e2e

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

src/app/core/components/home/currency-quotes/shared/services/currency-quotes.service.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { HttpClient, HttpHeaders } from '@angular/common/http';
1+
import { HttpClient, HttpParams } from '@angular/common/http';
22
import { PoMultiselectOption } from '@po-ui/ng-components';
33
import { inject, Injectable } from '@angular/core';
44
import { Observable } from 'rxjs';
@@ -10,13 +10,11 @@ import { AWESOMEAPI_APIKEY } from '../helpers/currency.constants';
1010
})
1111
export class CurrencyQuotesService {
1212
readonly apiUrl = 'https://economia.awesomeapi.com.br/json/last';
13-
readonly headers = new HttpHeaders({
14-
'x-api-key': AWESOMEAPI_APIKEY
15-
});
13+
readonly params = new HttpParams().set('token', AWESOMEAPI_APIKEY);
1614
private readonly http = inject(HttpClient);
1715

1816
getByCurrencyIds(currencyIds: string[]): Observable<CurrencyQuotes> {
19-
return this.http.get<CurrencyQuotes>(`${this.apiUrl}/${currencyIds.join(',')}`, { headers: this.headers });
17+
return this.http.get<CurrencyQuotes>(`${this.apiUrl}/${currencyIds.join(',')}`, { params: this.params });
2018
}
2119

2220
getCurrencyOptions(): PoMultiselectOption[] {

0 commit comments

Comments
 (0)