37 lines
770 B
TypeScript

import { createReducer, on } from '@ngrx/store';
import { initialState } from './state';
import {
buddy2Data,
buddy2Success,
group2Data,
group2Success
} from './actions';
export const reducer = createReducer(
initialState,
on(buddy2Data, (state, action) => {
return {
...state,
buddyInfoList: [...state.buddyInfoList, ...action.data.buddyInfos]
};
}),
on(buddy2Success, (state, action) => {
return {
...state,
buddy2SyncDate: action.res.syncDate
};
}),
on(group2Data, (state, action) => {
return {
...state,
groupList: [...state.groupList, action.data]
};
}),
on(group2Success, (state, action) => {
return {
...state,
group2SyncDate: action.res.syncDate
};
})
);