I found a way to do this by creating a custom interceptor and using NEVER
from rxjs
:
intercept(
request: HttpRequest<any>,
next: HttpHandler
): Observable<HttpEvent<any>> {
/**
* Deny list for calls we do not want to use from the Spartacus storefront
*/
if (request.url.includes('consenttemplates') || request.url.includes('carts') || request.url.includes('users/current')) {
return NEVER;
} else {
return next.handle(request);
}
}
CLICK HERE to find out more related problems solutions.