put in the ngrx
This commit is contained in:
+45
-11
@@ -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})))
|
||||
}
|
||||
*/
|
||||
Reference in New Issue
Block a user