32 lines
1022 B
TypeScript
32 lines
1022 B
TypeScript
import { APP_INITIALIZER, ApplicationConfig, provideBrowserGlobalErrorListeners } from '@angular/core';
|
|
import { provideHttpClient, withInterceptors } from '@angular/common/http';
|
|
import { provideRouter } from '@angular/router';
|
|
|
|
import { routes } from './app.routes';
|
|
import { authInterceptor } from './interceptors/auth.interceptor';
|
|
import {
|
|
appConfigInitProvider,
|
|
appConfigProvider,
|
|
} from './services/app-config.service';
|
|
import { StationConfigService } from './services/station-config.service';
|
|
|
|
export const stationConfigInitProvider = {
|
|
provide: APP_INITIALIZER,
|
|
useFactory: (stationConfigService: StationConfigService) => {
|
|
return () => stationConfigService.load();
|
|
},
|
|
deps: [StationConfigService],
|
|
multi: true,
|
|
};
|
|
|
|
export const appConfig: ApplicationConfig = {
|
|
providers: [
|
|
provideBrowserGlobalErrorListeners(),
|
|
provideRouter(routes),
|
|
provideHttpClient(withInterceptors([authInterceptor])),
|
|
appConfigProvider,
|
|
appConfigInitProvider,
|
|
stationConfigInitProvider,
|
|
],
|
|
};
|