import { message } from 'ant-design-vue'
import ErrorUtil from './error-util'

window.onunhandledrejection = function({ reason }) {
  if (reason.isAxiosError) {
    if (reason.response?.data?.code !== undefined) {
      ErrorUtil.handleError(reason.response.data)
    } else {
      // message.error('加载数据失败')
      console.log('window.onunhandledrejection data loading error:')
      console.log(reason)
    }
  }
}
