76 lines
2.9 KiB
TypeScript
76 lines
2.9 KiB
TypeScript
import { inject, provideAppInitializer } from "@angular/core";
|
|
import { ApplicationConfig, provideZoneChangeDetection } from "@angular/core";
|
|
import { provideRouter } from "@angular/router";
|
|
import { DatePipe } from "@angular/common";
|
|
import { provideHttpClient, withInterceptors } from "@angular/common/http";
|
|
|
|
import { DateService } from "../services/date.service";
|
|
import { AircraftService } from "../services/aircraft.service";
|
|
import { DropzoneService } from "../services/dropzone.service";
|
|
import { GearService } from "../services/gear.service";
|
|
import { JumpService } from "../services/jump.service";
|
|
import { JumpTypeService } from "../services/jump-type.service";
|
|
import { StatsService } from "../services/stats.service";
|
|
import { ServiceComm } from "../services/service-comm.service";
|
|
import { RequestCache } from "../services/request-cache.service";
|
|
import { ImageService } from "../services/image.service";
|
|
import { ConfigurationHelper } from "../services/configuration-helper";
|
|
import { ServiceCacheApi } from "../services/service-cache-api.service";
|
|
import { TunnelService } from "../services/tunnel.service";
|
|
import { TunnelFlightService } from "../services/tunnel-flight.service";
|
|
|
|
import { provideCharts, withDefaultRegisterables } from "ng2-charts";
|
|
|
|
import { JwtAuthInterceptor } from "../interceptor/jwt-auth.interceptor";
|
|
import { ErrorInterceptor } from "../interceptor/error.interceptor";
|
|
import { environment } from "../environments/environment";
|
|
|
|
import { routes } from "./app.routes";
|
|
|
|
import { provideTranslateService } from "@ngx-translate/core";
|
|
import { provideTranslateHttpLoader } from "@ngx-translate/http-loader";
|
|
|
|
// Déclaration de la fonction d'initialisation de la configuration
|
|
export function initConfig(configService: ConfigurationHelper) {
|
|
return () => configService.load(environment.env);
|
|
}
|
|
|
|
export const appConfig: ApplicationConfig = {
|
|
providers: [
|
|
TunnelService,
|
|
TunnelFlightService,
|
|
ImageService,
|
|
AircraftService,
|
|
DropzoneService,
|
|
GearService,
|
|
JumpService,
|
|
JumpTypeService,
|
|
StatsService,
|
|
ServiceComm,
|
|
DateService,
|
|
RequestCache,
|
|
ConfigurationHelper,
|
|
DatePipe,
|
|
ServiceCacheApi,
|
|
provideAppInitializer(() => {
|
|
const initializerFn = initConfig(inject(ConfigurationHelper));
|
|
return initializerFn();
|
|
}),
|
|
provideHttpClient(
|
|
withInterceptors([JwtAuthInterceptor, ErrorInterceptor]),
|
|
),
|
|
provideCharts(withDefaultRegisterables()),
|
|
provideZoneChangeDetection({ eventCoalescing: true }),
|
|
provideRouter(routes),
|
|
provideHttpClient(),
|
|
provideTranslateService({
|
|
loader: provideTranslateHttpLoader({
|
|
prefix: "/assets/i18n/",
|
|
suffix: ".json",
|
|
}),
|
|
fallbackLang: "en",
|
|
lang: "en",
|
|
}),
|
|
],
|
|
};
|