mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-15 14:03:06 +00:00
no more build errors, still issues with the selectors not returning anything
This commit is contained in:
@@ -1,45 +1,17 @@
|
||||
import { combineReducers, ActionReducer } from '@ngrx/store';
|
||||
import { routerReducer, RouterState } from '@ngrx/router-store';
|
||||
import { storeFreeze } from 'ngrx-store-freeze';
|
||||
import { compose } from '@ngrx/store';
|
||||
import { ActionReducerMap } from '@ngrx/store';
|
||||
import * as fromRouter from '@ngrx/router-store';
|
||||
|
||||
import { headerReducer, HeaderState } from './header/header.reducer';
|
||||
import { hostWindowReducer, HostWindowState } from './shared/host-window.reducer';
|
||||
import { CoreState, coreReducer } from './core/core.reducers';
|
||||
|
||||
import { StoreActionTypes } from './store.actions';
|
||||
|
||||
import { ENV_CONFIG } from '../config';
|
||||
|
||||
export interface AppState {
|
||||
core: CoreState;
|
||||
router: RouterState;
|
||||
router: fromRouter.RouterReducerState;
|
||||
hostWindow: HostWindowState;
|
||||
header: HeaderState;
|
||||
}
|
||||
|
||||
export const reducers = {
|
||||
core: coreReducer,
|
||||
router: routerReducer,
|
||||
export const appReducers: ActionReducerMap<AppState> = {
|
||||
router: fromRouter.routerReducer,
|
||||
hostWindow: hostWindowReducer,
|
||||
header: headerReducer
|
||||
};
|
||||
|
||||
export function rootReducer(state: any, action: any) {
|
||||
switch (action.type) {
|
||||
case StoreActionTypes.REHYDRATE:
|
||||
state = Object.assign({}, state, action.payload);
|
||||
break;
|
||||
case StoreActionTypes.REPLAY:
|
||||
break;
|
||||
default:
|
||||
}
|
||||
let root: ActionReducer<any>;
|
||||
// TODO: attempt to not use InjectionToken GLOBAL_CONFIG over GlobalConfig ENV_CONFIG
|
||||
if (ENV_CONFIG.production) {
|
||||
root = combineReducers(reducers)(state, action);
|
||||
} else {
|
||||
root = compose(storeFreeze, combineReducers)(reducers)(state, action);
|
||||
}
|
||||
return root;
|
||||
}
|
||||
|
Reference in New Issue
Block a user