import type { InternalAxiosRequestConfig, AxiosResponse } from 'axios'
import { ResultEnum } from '@/enums/HttpEnum'
const defaultRequestInterceptors = (config: InternalAxiosRequestConfig) => {
  return config
}

const defaultResponseInterceptors = (response: AxiosResponse) => {
  const { code } = response.data
  if (response?.config?.responseType === 'blob') {
    // 如果是文件流，直接过
    return response
  } else if (code === ResultEnum.SUCCESS) {
    return response.data
  }
}

export { defaultResponseInterceptors, defaultRequestInterceptors }
