import axios from 'axios';
import { NiceAxiosError } from '@/shared/@types/error';
import { IS_MOCK_PHASE } from '@/shared/constants/environment';

// CBDCAxiosError가 아니라면 상위 Error Boundary로 위임
export const checkIsAxiosError = (error: Error): error is NiceAxiosError => axios.isAxiosError(error);

export const checkIsKickOutError = (error: NiceAxiosError) => {
  const status = error.response?.status.toString();
  return !IS_MOCK_PHASE && (status === '401' || status === '403');
};
