Remove app.config.ts, integrate configuration directly in main.ts, and refactor providers to include authInterceptor.

This commit is contained in:
akastijn 2025-08-05 23:41:25 +02:00
parent e825d83124
commit d73f057596
2 changed files with 8 additions and 22 deletions

View File

@ -1,18 +0,0 @@
import {ApplicationConfig, provideZoneChangeDetection} from '@angular/core';
import {provideRouter} from '@angular/router';
import {CookieService} from 'ngx-cookie-service';
import {routes} from './app.routes';
import {provideHttpClient, withInterceptors} from '@angular/common/http';
import {authInterceptor} from '@services/AuthInterceptor';
export const appConfig: ApplicationConfig = {
providers: [
provideZoneChangeDetection({eventCoalescing: true}),
provideRouter(routes),
CookieService,
provideHttpClient(
withInterceptors([authInterceptor])
),
]
};

View File

@ -2,15 +2,19 @@ import {bootstrapApplication} from '@angular/platform-browser';
import {AppComponent} from './app/app.component'; import {AppComponent} from './app/app.component';
import {provideRouter} from '@angular/router'; import {provideRouter} from '@angular/router';
import {routes} from './app/app.routes'; import {routes} from './app/app.routes';
import {provideHttpClient} from '@angular/common/http'; import {provideHttpClient, withInterceptors} from '@angular/common/http';
import {BASE_PATH} from './api'; import {BASE_PATH} from '@api';
import {environment} from './environments/environment'; import {environment} from '@environment';
import {authInterceptor} from '@services/AuthInterceptor';
bootstrapApplication(AppComponent, { bootstrapApplication(AppComponent, {
providers: [ providers: [
provideRouter(routes), provideRouter(routes),
provideHttpClient(), provideHttpClient(),
{provide: BASE_PATH, useValue: environment.apiUrl} {provide: BASE_PATH, useValue: environment.apiUrl},
provideHttpClient(
withInterceptors([authInterceptor])
),
] ]
}).catch(err => console.error(err)); }).catch(err => console.error(err));