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

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

export function reducer(state = initialState, action: Actions): State {
  switch (action.type) {
    case ActionType.ResetPassword: {
      return {
        pending: true,
        error: null,
      };
    }

    case ActionType.ResetPasswordSuccess: {
      return {
        pending: false,
        error: null,
      };
    }

    case ActionType.ResetPasswordFailure: {
      return {
        pending: false,
        error: action.payload,
      };
    }

    default: {
      return state;
    }
  }
}

