Files
codiki-hexagonal/frontend/src/app/app.config.ts
2024-10-15 16:11:46 +02:00

30 lines
1.1 KiB
TypeScript

import { APP_INITIALIZER, ApplicationConfig } from '@angular/core';
import { provideRouter, withRouterConfig } from '@angular/router';
import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
import { routes } from './app.routes';
import { JwtInterceptor } from './core/interceptor/jwt.interceptor';
import { AuthenticationService } from './core/service/authentication.service';
export const appConfig: ApplicationConfig = {
providers: [
provideRouter(
routes,
withRouterConfig({
paramsInheritanceStrategy: 'always',
onSameUrlNavigation: 'reload'
})
),
provideAnimationsAsync(),
provideHttpClient(withInterceptorsFromDi()),
{ provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true },
{
provide: APP_INITIALIZER,
useFactory: (authenticationService: AuthenticationService) => () => authenticationService.startAuthenticationCheckingProcess(),
deps: [AuthenticationService],
multi: true
}
]
};