Is is possible to disable some of the default Spartacus calls?
After the user is logged in there are some calls that are made by default, but I do not need and would like to disable if possible.
These are the calls:
"...users/current",
"...users/current/consenttemplates...",
"...users/current/carts..."
The second and third one are made exactly after the login process and the first one is made after a page refresh or when navigating to different pages.
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);
}
}