22 lines
480 B
TypeScript
Raw Normal View History

2019-10-08 13:18:05 +09:00
import { createReducer, on } from '@ngrx/store';
import { initialState } from './state';
2019-10-08 14:59:22 +09:00
import { infoSuccess, appendInfoList } from './actions';
2019-10-08 13:18:05 +09:00
export const reducer = createReducer(
initialState,
on(infoSuccess, (state, action) => {
return {
...state,
infoList: action.infoList,
infoStatus: action.res
};
2019-10-08 14:59:22 +09:00
}),
on(appendInfoList, (state, action) => {
return {
...state,
infoList: [...state.infoList, action.info]
};
2019-10-08 13:18:05 +09:00
})
);