File tree Expand file tree Collapse file tree
src/app/core/components/home/currency-quotes/shared/services Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { HttpClient , HttpHeaders } from '@angular/common/http' ;
1+ import { HttpClient , HttpParams } from '@angular/common/http' ;
22import { PoMultiselectOption } from '@po-ui/ng-components' ;
33import { inject , Injectable } from '@angular/core' ;
44import { Observable } from 'rxjs' ;
@@ -10,13 +10,11 @@ import { AWESOMEAPI_APIKEY } from '../helpers/currency.constants';
1010} )
1111export 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 [ ] {
You can’t perform that action at this time.
0 commit comments