put in the ngrx

This commit is contained in:
2026-03-12 18:29:12 +11:00
parent c5e641180b
commit d1d5d88f9c
13 changed files with 233 additions and 48 deletions
+45 -11
View File
@@ -8,23 +8,57 @@ import { routes } from './app.routes';
import MyPreset from './mythem';
import { JwtInterceptor, ErrorInterceptor, initializeApp } from './shares';
import { provideStore } from '@ngrx/store';
import { provideStoreDevtools } from '@ngrx/store-devtools';
import { isDevMode } from '@angular/core';
import { provideEffects } from '@ngrx/effects';
import { staffEffects,staffsReducer } from './state';
export const appConfig: ApplicationConfig = {
providers: [
provideStore({
myStaffs: staffsReducer,
}),
provideStoreDevtools({
maxAge: 25,
logOnly: !isDevMode()
}),
provideBrowserGlobalErrorListeners(),
MessageService, ConfirmationService,
provideAppInitializer(initializeApp()),
provideHttpClient(withInterceptors([JwtInterceptor, ErrorInterceptor])),
MessageService, ConfirmationService,
provideAppInitializer(initializeApp()),
provideHttpClient(withInterceptors([JwtInterceptor, ErrorInterceptor])),
provideRouter(routes, withComponentInputBinding()),
providePrimeNG({
theme: {
preset: MyPreset,
options: {
cssLayer: {
providePrimeNG({
theme: {
preset: MyPreset,
options: {
cssLayer: {
name: 'primeng',
order: 'theme, base, primeng'
}
}
}
}),
]
}
}),
provideEffects([staffEffects])
]
};
/*
import { Store } from '@ngrx/store';
private readonly store = inject(Store);
protected books = this.store.selectSignal(selectBooks);
protected onAdd(id: number) {
this.store.dispatch(StaffsActions.addStaff({ id }));
}
protected onRemove(id: number) {
this.store.dispatch(StaffsActions.removeStaff({ id }));
}
on ngOnInit() {
use it normal get from API first
and subscribe( (x) => this.store.dispatch(StaffApiAction.LoadStaffList({x})))
}
*/