member_webapp/@overflow/member/store/container/modify/member-modify.reducer.ts

39 lines
631 B
TypeScript
Raw Normal View History

2018-05-28 05:41:56 +00:00
import {
Actions,
ActionType,
} from '../../entity/member/member.action';
import {
State,
initialState,
2018-05-28 07:51:33 +00:00
} from './member-modify.state';
2018-05-28 05:41:56 +00:00
export function reducer(state = initialState, action: Actions): State {
switch (action.type) {
case ActionType.Modify: {
return {
pending: true,
2018-05-28 07:51:33 +00:00
error: null,
2018-05-28 05:41:56 +00:00
};
}
case ActionType.ModifySuccess: {
return {
pending: false,
2018-05-28 07:51:33 +00:00
error: null,
2018-05-28 05:41:56 +00:00
};
}
case ActionType.ModifyFailure: {
return {
pending: false,
2018-05-28 07:51:33 +00:00
error: action.payload,
2018-05-28 05:41:56 +00:00
};
}
default: {
return state;
}
}
}