UNPKG

loop-modules

Version:

Shared modules for the Loop product suite.

104 lines (88 loc) 2.79 kB
// libs import { ActionReducer } from '@ngrx/store'; import { compose } from '@ngrx/core/compose'; import { combineReducers } from '@ngrx/store'; import { storeFreeze } from 'ngrx-store-freeze'; // app import { EmployeeState } from './employee.state'; import { LoopActivityMessageState } from './loop-activity-message.state'; import { LoopActivityState } from './loop-activity.state'; import { LoopAssignmentState } from './loop-assignment.state'; import { LoopDocumentState } from './loop-document.state'; import { LoopScenarioState } from './loop-scenario.state'; import { LoopSessionState } from './loop-session.state'; import { LoopTopicState } from './loop-topic.state'; import { LoopTrendingActivityState } from './loop-trending-activity.state'; import { LoopUserState } from './loop-user.state'; import { reducers } from '../reducers/index'; export interface AppState { /** * The AppState slice that represents Loop Activities * * @type {LoopActivityState} */ activities: LoopActivityState; /** * The AppState slice that represents Loop Activity Messages * * @type {LoopActivityMessageState} */ activityMessages: LoopActivityMessageState; /** * The AppState slice that represents Loop Assignments * * @type {LoopAssignmentState} */ assignments: LoopAssignmentState; /** * The AppState slice that represents Loop Documents * * @type {LoopDocumentState} */ documents: LoopDocumentState; /** * The AppState slice that represents Employees * * @type {EmployeeState} */ employees: EmployeeState; /** * The AppState slice that represents Loop Scenarios * * @type {LoopScenarioState} */ scenarios: LoopScenarioState; /** * The AppState slice that represents Loop Sessions * * @type {LoopSessionState} */ sessions: LoopSessionState; /** * The AppState slice that represents Loop Topics * * @type {LoopTopicState} */ topics: LoopTopicState; /** * The AppState slice that represents Loop Trending Activities * * @type {LoopTrendingActivityState} */ trendingActivities: LoopTrendingActivityState; /** * The AppState slice that represents users * * @type {LoopUserState} */ users: LoopUserState; } const developmentReducer: ActionReducer<AppState> = compose(storeFreeze, combineReducers)(reducers); const productionReducer: ActionReducer<AppState> = combineReducers(reducers); export function AppReducer(state: any, action: any) { if (String('<%= BUILD_TYPE %>') === 'dev') { return developmentReducer(state, action); } else { return productionReducer(state, action); } }