import { createReducer, on } from '@ngrx/store'; import { initialState } from './state'; import { authSuccess, deptSuccess, deptUserSuccess } from './actions'; import * as AuthenticationStore from '@app/store/account/authentication'; export const reducer = createReducer( initialState, on(authSuccess, (state, action) => { return { ...state, auth: action.res }; }), on(deptSuccess, (state, action) => { return { ...state, departmentInfoList: action.departmentInfoList }; }), on(deptUserSuccess, (state, action) => { return { ...state, selectedDepartmentUserInfoList: action.userInfos, selectedDepartmentStatus: action.res }; }), on(AuthenticationStore.logout, (state, action) => { return { ...initialState }; }) );