41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
import { HttpRequest, provideHttpClient, withFetch, withInterceptors } from '@angular/common/http';
|
|
import {
|
|
ApplicationConfig,
|
|
provideAppInitializer,
|
|
provideBrowserGlobalErrorListeners,
|
|
} from '@angular/core';
|
|
import { provideRouter } from '@angular/router';
|
|
import { provideClientHydration, withHttpTransferCacheOptions } from '@angular/platform-browser';
|
|
|
|
import { routes } from './app.routes';
|
|
import { authBootstrap } from './core/services/auth/auth-bootstrap';
|
|
import { authInterceptor } from './core/services/auth/auth.interceptor';
|
|
import { globalLoadingInterceptor } from './core/services/global-loading/global-loading.interceptor';
|
|
import { tenantBootstrap } from './core/services/tenant-bootstrap';
|
|
|
|
function isStoreCatalogRequest(request: HttpRequest<unknown>): boolean {
|
|
return (
|
|
request.method === 'GET' &&
|
|
/\/api\/tenants\/[^/]+\/productos(?:\/\d+)?(?:\?|$)/.test(request.urlWithParams)
|
|
);
|
|
}
|
|
|
|
export const appConfig: ApplicationConfig = {
|
|
providers: [
|
|
provideBrowserGlobalErrorListeners(),
|
|
provideRouter(routes),
|
|
provideClientHydration(
|
|
withHttpTransferCacheOptions({
|
|
includeRequestsWithAuthHeaders: true,
|
|
filter: isStoreCatalogRequest,
|
|
}),
|
|
),
|
|
provideHttpClient(
|
|
withFetch(),
|
|
withInterceptors([authInterceptor, globalLoadingInterceptor])
|
|
),
|
|
provideAppInitializer(authBootstrap),
|
|
provideAppInitializer(tenantBootstrap),
|
|
],
|
|
};
|