Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

151
Views
Quiero usar @ngneat/anacardo con interceptor para la solicitud HTTP de caché, ¿es posible?

Lea las instrucciones de @ngneat/cashew antes de responder esta pregunta desde aquí @ngneat/anacardo

La idea es simple en lugar de hacer esto en un nivel de service como este,

 this.httpClient.get<Posts>(`http://localhost:3000/posts/${id}`,{context:withCache()});

Quiero hacer un interceptor global. Aquí está mi fragmento de código,

 # Config of Interceptor { provide: HTTP_INTERCEPTORS, useClass: CacheInterceptor, multi: true }
 # Here is CacheInterceptor intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { const modifiedRequest = request.clone( {context: withCache()} ); return next.handle(modifiedRequest); }

Quiero hacer esto porque agregar { context : withCache() } en el método de cada servicio es repetitivo; de lo contrario, en un proyecto existente sería demasiado lento. Es por eso que quiero lograr esto haciendo un Interceptor personalizado. ¿Es posible lograrlo?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!