Skip to content

Commit

Permalink
fix(ngrx-notification): compilation error
Browse files Browse the repository at this point in the history
Due to upgrading to Angular 16,  `REDUCERS` were in the incorrect file and
should have been moved to `app.config.ts` from `main.ts`.
  • Loading branch information
AlDrag committed Jul 5, 2023
1 parent f577efb commit 65f3d0e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 15 additions & 1 deletion apps/ngrx-notification/src/app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
16 changes: 1 addition & 15 deletions apps/ngrx-notification/src/main.ts
Original file line number Diff line number Diff line change
@@ -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)
);

0 comments on commit 65f3d0e

Please sign in to comment.