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 11:42:39 +00:00
|
|
|
member: null,
|
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 11:42:39 +00:00
|
|
|
member: action.payload,
|
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 11:42:39 +00:00
|
|
|
member: null,
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|