Files
brewman/overlord/src/app/app.config.ts
T

49 lines
1.7 KiB
TypeScript

import { provideHttpClient, withInterceptors } from '@angular/common/http';
import {
ApplicationConfig,
importProvidersFrom,
isDevMode,
LOCALE_ID,
provideZonelessChangeDetection,
} from '@angular/core';
import { MomentDateAdapter } from '@angular/material-moment-adapter';
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core';
import { MAT_SNACK_BAR_DEFAULT_OPTIONS } from '@angular/material/snack-bar';
import { BrowserModule } from '@angular/platform-browser';
import { provideRouter, withComponentInputBinding, withRouterConfig } from '@angular/router';
import { dateFormat } from './app.environment';
import { routes } from './app.routes';
import { AuthService } from './auth/auth.service';
import { authInterceptor } from './core/auth.interceptor';
import { delayInterceptor } from './core/delay-interceptor';
import { jwtInterceptor } from './core/jwt.interceptor';
import { refreshInterceptor } from './core/refresh.interceptor';
export const appConfig: ApplicationConfig = {
providers: [
importProvidersFrom(BrowserModule),
{ provide: LOCALE_ID, useValue: 'en-IN' },
AuthService,
provideHttpClient(
withInterceptors([
authInterceptor,
jwtInterceptor,
refreshInterceptor,
...(isDevMode() ? [delayInterceptor] : []),
]),
),
provideRouter(
routes,
withRouterConfig({
onSameUrlNavigation: 'reload',
}),
withComponentInputBinding(),
),
{ provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE] },
{ provide: MAT_DATE_FORMATS, useValue: dateFormat },
{ provide: MAT_SNACK_BAR_DEFAULT_OPTIONS, useValue: { duration: 3000 } },
provideZonelessChangeDetection(),
],
};