0
I need help handling the attributes being returned from my API. I want to intercept them in my service class, but I’m not getting through using Subscribe.
export class Lancamentoservice {
lancamentoUrl = 'http://localhost:8080/lancamentos';
constructor(private http: HttpClient) { }
pesquisar(filtro: any): Observable<Lancamento> {
let params = new HttpParams();
params = params.set('page', filtro.pagina);
params = params.set('size', filtro.itensPorPagina);
if (filtro.descricao) {
params = params.set('descricao', filtro.descricao);
}
if (filtro.dataVencimentoInicio) {
params = params.set('dataVencimentoDe', moment(filtro.dataVencimentoInicio).format('YYYY-MM-DD'));
}
if (filtro.dataVencimentoFim) {
params = params.set('dataVencimentoAte', moment(filtro.dataVencimentoFim).format('YYYY-MM-DD'));
}
return this.http.get<Lancamento>(`${this.lancamentoUrl}?resumo`, { params } );
}
I demarched the attributes I want to manipulate.
I had to edit my answer rs, you changed your question 3x hahah
– Pedro Henrique Cndido Ferreira
Sorry, it’s the first time I’m looking for help in the stack.
– Afrain Calixto
No problem, see if my answer helps you, whenever you need can seek the community, if not comment there in the answer.
– Pedro Henrique Cndido Ferreira
Thanks for your attention, I’ll take a look at the documentation of Rxjs that sent me the link and in case I don’t get I return here.
– Afrain Calixto
I gave an example using pipe with map in the service, I think it solves your problem
– Pedro Henrique Cndido Ferreira