import { fileUpload } from '@/api/system'

export default function(blobInfo, succFun, failFun) {
  const file = blobInfo.blob()
  const formData = new window.FormData()
  formData.append('file', file)
  formData.append('type', 'image')
  fileUpload(formData)
    .then(response => {
      const [first] = response.data
      response.code === 0 ? succFun(first.full_path) : failFun(response.message)
    })
    .catch(response => {
      failFun(response.message)
    })
}
