diff --git a/client/src/app/app.config.ts b/client/src/app/app.config.ts index ffdf2b5..19ae0f8 100644 --- a/client/src/app/app.config.ts +++ b/client/src/app/app.config.ts @@ -1,32 +1,41 @@ -import {APP_INITIALIZER, ApplicationConfig, inject, provideZoneChangeDetection} from '@angular/core'; +import { + APP_INITIALIZER, + ApplicationConfig, + inject, + provideZoneChangeDetection, + importProvidersFrom +} from '@angular/core'; import {provideRouter} from '@angular/router'; - +import {BrowserModule} from '@angular/platform-browser'; +import {APP_BASE_HREF} from '@angular/common'; import {routes} from './app.routes'; import {provideHttpClient, withInterceptors} from '@angular/common/http'; import {provideAnimationsAsync} from '@angular/platform-browser/animations/async'; import {authTokenInterceptor} from './interceptors/auth-token.interceptor'; import {AuthService} from './services/auth.service'; import {catchError, firstValueFrom, of} from 'rxjs'; +import {environment} from '../environments/environment'; export const appConfig: ApplicationConfig = { providers: [ provideZoneChangeDetection({eventCoalescing: true}), + importProvidersFrom(BrowserModule), + {provide: APP_BASE_HREF, useValue: environment.hrefBase}, provideRouter(routes), provideAnimationsAsync(), - provideHttpClient(withInterceptors([ - authTokenInterceptor - ]) - ), + provideHttpClient(withInterceptors([authTokenInterceptor])), { provide: APP_INITIALIZER, multi: true, useFactory: () => { const auth = inject(AuthService); - return () => firstValueFrom(auth.bootstrapSession().pipe( - catchError(err => of(null)) - ) - ); + return () => + firstValueFrom( + auth.bootstrapSession().pipe( + catchError(() => of(null)) + ) + ); } - }, provideAnimationsAsync() + } ] }; diff --git a/client/src/environments/environment.prod.ts b/client/src/environments/environment.prod.ts index 0a896ad..dad186e 100644 --- a/client/src/environments/environment.prod.ts +++ b/client/src/environments/environment.prod.ts @@ -2,5 +2,5 @@ export const environment = { production: true, apiUrl: '/gameovergne-api/api', psUrl: '/gameovergne-api/api/ps', - indexBase: '/gameovergne/', + hrefBase: '/gameovergne/', }; diff --git a/client/src/environments/environment.ts b/client/src/environments/environment.ts index 862965c..304b7d7 100644 --- a/client/src/environments/environment.ts +++ b/client/src/environments/environment.ts @@ -2,5 +2,5 @@ export const environment = { production: false, apiUrl: 'http://localhost:3000/api', psUrl: '/ps', - indexBase: '/', + hrefBase: '/', }; diff --git a/client/src/index.html b/client/src/index.html index cb3be92..260c6b0 100644 --- a/client/src/index.html +++ b/client/src/index.html @@ -3,10 +3,6 @@ Game Over'gne App -