/**
 * 头像图片错误处理专用函数
 * @param {Event} e - 图片错误事件
 */
export const handleAvatarImageError = (e) => {
  console.log('头像资源出错')
  e.target.onerror = null // 防止循环
  e.target.src = new URL('/src/assets/icon/Aslan/defaultAvatar.png', import.meta.url).href
}

export const handleRewardImageError = (e, type) => {
  console.log('图片资源出错')
  e.target.onerror = null // 防止循环

  if (type == 'GOLD') {
    e.target.src = new URL('/src/assets/icon/Aslan/coin.png', import.meta.url).href
  } else if (type == 'DOLLARS') {
    e.target.src = new URL('/src/assets/icon/Aslan/dollar.png', import.meta.url).href
  }
}
