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

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

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