2019-09-25 17:26:19 +09:00
|
|
|
import { createReducer, on } from '@ngrx/store';
|
|
|
|
import { initialState } from './state';
|
2019-09-25 18:08:50 +09:00
|
|
|
import {
|
|
|
|
buddy2Data,
|
|
|
|
buddy2Success,
|
|
|
|
group2Data,
|
|
|
|
group2Success
|
|
|
|
} from './actions';
|
2019-09-25 17:26:19 +09:00
|
|
|
|
|
|
|
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
|
|
|
|
};
|
2019-09-25 18:08:50 +09:00
|
|
|
}),
|
|
|
|
on(group2Data, (state, action) => {
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
groupList: [...state.groupList, action.data]
|
|
|
|
};
|
|
|
|
}),
|
|
|
|
on(group2Success, (state, action) => {
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
group2SyncDate: action.res.syncDate
|
|
|
|
};
|
2019-09-25 17:26:19 +09:00
|
|
|
})
|
|
|
|
);
|