import { Actions as MemberActions, ActionType as MemberActionType, } from '../../entity/member/member.action'; import { State, initialState, } from './member-signin.state'; import { Actions as AuthActions, ActionType as AuthActionType, } from '@overflow/shared/auth/store/container/auth'; export function reducer(state: State = initialState, action: MemberActions | AuthActions): State { switch (action.type) { case MemberActionType.Signin: { return { member: null, pending: true, error: null, }; } case AuthActionType.SigninSuccess: { return { member: action.payload.domainMember.member, pending: false, error: null, }; } case AuthActionType.SigninFailure: { return { member: null, pending: false, error: action.payload, }; } default: { return state; } } }