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

42 lines
723 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 {
2018-05-29 09:32:22 +00:00
signupComplete: false,
2018-05-28 05:41:56 +00:00
pending: true,
2018-05-28 07:51:33 +00:00
error: null,
2018-05-28 05:41:56 +00:00
};
}
case ActionType.SignupSuccess: {
return {
2018-05-29 09:32:22 +00:00
signupComplete: true,
2018-05-28 05:41:56 +00:00
pending: false,
2018-05-28 07:51:33 +00:00
error: null,
2018-05-28 05:41:56 +00:00
};
}
case ActionType.SignupFailure: {
return {
2018-05-29 09:32:22 +00:00
signupComplete: false,
2018-05-28 05:41:56 +00:00
pending: false,
2018-05-28 07:51:33 +00:00
error: action.payload,
2018-05-28 05:41:56 +00:00
};
}
default: {
return state;
}
}
}