48 lines
1.8 KiB
TypeScript
48 lines
1.8 KiB
TypeScript
import { ApplicationConfig, importProvidersFrom } from '@angular/core';
|
|
import { LocationStrategy, HashLocationStrategy } from '@angular/common';
|
|
import { HTTP_INTERCEPTORS, HttpClient, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
|
|
// libs
|
|
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
|
|
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
|
|
import { LoadingBarRouterModule } from '@ngx-loading-bar/router';
|
|
import { LoadingBarHttpClientModule } from '@ngx-loading-bar/http-client';
|
|
import { NgScrollbarModule } from 'ngx-scrollbar';
|
|
|
|
// app
|
|
import { CoreModule } from './core/core.module';
|
|
import { AppRoutingModule } from './app-routing.module';
|
|
import { ErrorInterceptor } from './core/interceptor/error.interceptor';
|
|
import { UpdateDateHttpInterceptor } from './core/interceptor/update.date.http.interceptor ';
|
|
|
|
export function createTranslateLoader(http: HttpClient) {
|
|
return new TranslateHttpLoader(http, 'assets/i18n/', '.json');
|
|
}
|
|
|
|
export const appConfig: ApplicationConfig = {
|
|
providers: [
|
|
importProvidersFrom(
|
|
BrowserAnimationsModule,
|
|
AppRoutingModule,
|
|
LoadingBarHttpClientModule,
|
|
LoadingBarRouterModule,
|
|
NgScrollbarModule,
|
|
TranslateModule.forRoot({
|
|
loader: {
|
|
provide: TranslateLoader,
|
|
useFactory: createTranslateLoader,
|
|
deps: [HttpClient],
|
|
},
|
|
}),
|
|
// core & shared
|
|
CoreModule,
|
|
),
|
|
{ provide: LocationStrategy, useClass: HashLocationStrategy },
|
|
// Bearer tokens: angular-oauth2-oidc resourceServer (AuthModuleConfig.sendAccessToken)
|
|
{ provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true },
|
|
{ provide: HTTP_INTERCEPTORS, useClass: UpdateDateHttpInterceptor, multi: true },
|
|
provideHttpClient(withInterceptorsFromDi()),
|
|
],
|
|
};
|