41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
import { ApplicationConfig, APP_INITIALIZER } from '@angular/core';
|
|
import { provideRouter } from '@angular/router';
|
|
import { routes } from './app.routes';
|
|
import { provideClientHydration } from '@angular/platform-browser';
|
|
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
|
|
import { APP_BASE_HREF } from '@angular/common';
|
|
import { UrlService } from './services/url.service';
|
|
import { API_URL } from './tokens/index'
|
|
import { HTTP_INTERCEPTORS, provideHttpClient, withFetch } from '@angular/common/http';
|
|
import { HttpRequestInterceptor } from './http.interceptor';
|
|
import { ConfigurationService } from './services/configuration.service';
|
|
|
|
export const appConfig: ApplicationConfig = {
|
|
providers: [
|
|
provideRouter(routes),
|
|
provideClientHydration(),
|
|
provideAnimationsAsync(),
|
|
provideHttpClient(withFetch()),
|
|
{
|
|
provide: APP_BASE_HREF,
|
|
useFactory: (urlService: UrlService) => urlService.getBaseHref(),
|
|
deps: [UrlService]
|
|
},
|
|
{
|
|
provide: API_URL,
|
|
useFactory: (urlService: UrlService) => urlService.getApiUrl(),
|
|
deps: [UrlService]
|
|
},
|
|
{
|
|
provide: HTTP_INTERCEPTORS,
|
|
useClass: HttpRequestInterceptor,
|
|
multi: true
|
|
},
|
|
{
|
|
provide: APP_INITIALIZER,
|
|
useFactory: (configService: ConfigurationService) => async () => await configService.ngOnInit(),
|
|
deps: [ConfigurationService],
|
|
multi: true
|
|
}
|
|
]
|
|
}; |