member_webapp/src/packages/member/store/signup/signup.reducer.ts

46 lines
753 B
TypeScript
Raw Normal View History

2018-04-06 06:59:49 +00:00
import {
Actions,
ActionType,
} from './signup.action';
import {
State,
initialState,
} from './signup.state';
import { Member } from '../../model';
export function reducer(state = initialState, action: Actions): State {
switch (action.type) {
case ActionType.Signup: {
return {
...state,
error: null,
pending: true,
};
}
case ActionType.SignupSuccess: {
return {
...state,
error: null,
pending: false,
member: action.payload,
};
}
case ActionType.SignupFailure: {
return {
...state,
error: action.payload,
pending: false,
member: null,
};
}
default: {
return state;
}
}
}