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

46 lines
783 B
TypeScript

import {
Actions,
ActionType,
} from './signup.action';
import {
State,
initialState,
} from './signup.state';
import { Member } from '@overflow/commons-typescript/model/member';
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;
}
}
}