Directly initialize JwtHelperService in auth service

This commit is contained in:
2025-07-06 19:14:06 +02:00
parent 04310e1cce
commit 42f0961f13
2 changed files with 3 additions and 19 deletions
+1 -17
View File
@@ -1,29 +1,13 @@
import {ApplicationConfig, importProvidersFrom, provideZoneChangeDetection} from '@angular/core';
import {ApplicationConfig, provideZoneChangeDetection} from '@angular/core';
import {provideRouter} from '@angular/router';
import {JwtHelperService, JwtModule} from '@auth0/angular-jwt';
import {CookieService} from 'ngx-cookie-service';
import {routes} from './app.routes';
export function jwtTokenGetter() {
return localStorage.getItem('jwt');
}
export const appConfig: ApplicationConfig = {
providers: [
provideZoneChangeDetection({eventCoalescing: true}),
provideRouter(routes),
CookieService,
{
provide: JwtHelperService,
useValue: new JwtHelperService()
},
importProvidersFrom(
JwtModule.forRoot({
config: {
tokenGetter: jwtTokenGetter
}
})
)
]
};