member_webapp/@overflow/member/store/modify/modify.reducer.ts
crusader d59d9379f9 ing
2018-05-24 15:44:13 +09:00

44 lines
714 B
TypeScript

import {
Actions,
ActionType,
} from './modify.action';
import {
State,
initialState,
} from './modify.state';
export function reducer(state = initialState, action: Actions): State {
switch (action.type) {
case ActionType.Modify: {
return {
...state,
error: null,
pending: true,
};
}
case ActionType.ModifySuccess: {
return {
...state,
error: null,
pending: false,
member: action.payload,
};
}
case ActionType.ModifyFailure: {
return {
...state,
error: action.payload,
pending: false,
member: null,
};
}
default: {
return state;
}
}
}