From 65f3d0e3d32153cc34aec92c21ead9fb1930f787 Mon Sep 17 00:00:00 2001 From: Alan Dragicevich Date: Thu, 6 Jul 2023 08:36:24 +1200 Subject: [PATCH] fix(ngrx-notification): compilation error Due to upgrading to Angular 16, `REDUCERS` were in the incorrect file and should have been moved to `app.config.ts` from `main.ts`. --- apps/ngrx-notification/src/app/app.config.ts | 16 +++++++++++++++- apps/ngrx-notification/src/main.ts | 16 +--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/ngrx-notification/src/app/app.config.ts b/apps/ngrx-notification/src/app/app.config.ts index 0de8569..52badc4 100644 --- a/apps/ngrx-notification/src/app/app.config.ts +++ b/apps/ngrx-notification/src/app/app.config.ts @@ -5,9 +5,23 @@ import { TeacherEffects } from './teacher/store/teacher.effects'; import { StudentEffects } from './student/store/student.effects'; import { provideRouter } from '@angular/router'; import { ROUTES } from './routes'; -import { APP_INITIALIZER, enableProdMode, inject } from '@angular/core'; +import { APP_INITIALIZER, inject } from '@angular/core'; import { FakeBackendService } from '@angular-challenges/ngrx-notification/backend'; import { NotificationService } from './data-access/notification.service'; +import { + teacherReducer, + teachersFeatureKey, +} from './teacher/store/teacher.reducer'; +import { + studentReducer, + studentsFeatureKey, +} from './student/store/student.reducer'; + +const REDUCERS = { + [teachersFeatureKey]: teacherReducer, + [studentsFeatureKey]: studentReducer, +}; + export const appConfig: ApplicationConfig = { providers: [ provideStore(REDUCERS), diff --git a/apps/ngrx-notification/src/main.ts b/apps/ngrx-notification/src/main.ts index 9ba7c56..3088684 100644 --- a/apps/ngrx-notification/src/main.ts +++ b/apps/ngrx-notification/src/main.ts @@ -1,29 +1,15 @@ import { appConfig } from './app/app.config'; import { bootstrapApplication } from '@angular/platform-browser'; +import { enableProdMode } from '@angular/core'; import { AppComponent } from './app/app.component'; - -import { - studentReducer, - studentsFeatureKey, -} from './app/student/store/student.reducer'; - -import { - teacherReducer, - teachersFeatureKey, -} from './app/teacher/store/teacher.reducer'; import { environment } from './environments/environment'; if (environment.production) { enableProdMode(); } -const REDUCERS = { - [teachersFeatureKey]: teacherReducer, - [studentsFeatureKey]: studentReducer, -}; - bootstrapApplication(AppComponent, appConfig).catch((err) => console.error(err) );