28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
import { ApplicationConfig, inject, provideAppInitializer } 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 },
|
|
provideAppInitializer(() => {
|
|
const initializerFn = ((authenticationService: AuthenticationService) => () => authenticationService.startAuthenticationCheckingProcess())(inject(AuthenticationService));
|
|
return initializerFn();
|
|
})
|
|
]
|
|
};
|