member_webapp/@overflow/member/store/container/signup/member-signup.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-signup.state';
2018-05-28 05:41:56 +00:00
export function reducer(state = initialState, action: Actions): State {
switch (action.type) {
case ActionType.Signup: {
return {
pending: true,
2018-05-28 07:51:33 +00:00
error: null,
2018-05-28 05:41:56 +00:00
};
}
case ActionType.SignupSuccess: {
return {
pending: false,
2018-05-28 07:51:33 +00:00
error: null,
2018-05-28 05:41:56 +00:00
};
}
case ActionType.SignupFailure: {
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;
}
}
}