import { get, post } from '../utils/http.js'

// 上传图片
export const uploadImg = async (file) => {
  try {
    const formData = new FormData()
    formData.append('file', file) // 这里的'file'需要与后端接口期望的参数名一致
    const response = await post('/external/oss/upload', formData)
    return response
  } catch (error) {
    console.error('Failed to upload img:', error)
    throw error
  }
}
