Update about the showing the user images

This commit is contained in:
Sébastien André
2021-03-26 15:05:06 +01:00
parent 9d51f38f2e
commit fe255041cc
12 changed files with 70 additions and 71 deletions

View File

@@ -19,21 +19,17 @@ export class CachingInterceptor implements HttpInterceptor {
intercept(req: HttpRequest<any>, next: HttpHandler) {
const cachedResponse = this.cache.get(req);
return cachedResponse
? Observable.of(cachedResponse)
: this.sendRequest(req, next);
return cachedResponse ? Observable.of(cachedResponse) : this.sendRequest(req, next);
}
sendRequest(
req: HttpRequest<any>,
next: HttpHandler
): Observable<HttpEvent<any>> {
return next.handle(req).pipe(
tap(event => {
if (event instanceof HttpResponse) {
this.cache.put(req, event);
}
})
sendRequest(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
return next.handle(req)
.pipe(
tap(event => {
if (event instanceof HttpResponse) {
this.cache.put(req, event);
}
})
);
}
}