feat(challenge7): add all mecanism

This commit is contained in:
thomas
2022-11-24 14:44:34 +01:00
parent e8ffed31ec
commit b76ff2b624
34 changed files with 604 additions and 142 deletions

View File

@@ -1,22 +1,44 @@
import { PushService } from '@angular-challenges/ngrx-notification/backend';
import { FakeBackendService } from '@angular-challenges/ngrx-notification/backend';
import { APP_INITIALIZER, enableProdMode, inject } from '@angular/core';
import { bootstrapApplication } from '@angular/platform-browser';
import { provideRouter } from '@angular/router';
import { provideEffects } from '@ngrx/effects';
import { provideStore } from '@ngrx/store';
import { AppComponent } from './app/app.component';
import { NotificationService } from './app/data-access/notification.service';
import { ROUTES } from './app/routes';
import { StudentEffects } from './app/student/store/student.effects';
import {
studentReducer,
studentsFeatureKey,
} from './app/student/store/student.reducer';
import { TeacherEffects } from './app/teacher/store/teacher.effects';
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, {
providers: [
provideStore(REDUCERS),
provideEffects([TeacherEffects, StudentEffects]),
provideRouter(ROUTES),
{
provide: APP_INITIALIZER,
multi: true,
useFactory: () => {
const service = inject(PushService);
return () => service.init();
const service = inject(FakeBackendService);
return () => service.start();
},
},
{