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; } } }