import {
  Actions as MemberActions,
  ActionType as MemberActionType,
} from '../../entity/member/member.action';

import {
  State,
  initialState,
} from './member-signout.state';

import {
  Actions as AuthActions,
  ActionType as AuthActionType,
} from '@overflow/shared/auth/store/container/auth';


export function reducer(state = initialState, action: MemberActions | AuthActions): State {
  switch (action.type) {
    case MemberActionType.Signout: {
      return {
        pending: true,
        error: null,
      };
    }

    case AuthActionType.SignoutSuccess: {
      return {
        pending: false,
        error: null,
      };
    }

    case AuthActionType.SignoutFailure: {
      return {
        pending: false,
        error: null,
      };
    }

    default: {
      return state;
    }
  }
}