import api from './api'
import ajax from './ajax'

export default function upload (file) {
  console.log(file)
  return new Promise((resolve, reject) => {
    ajax({
      ...api.file.image,
      data: { file: file },
    }).then(({ url }) => {
      resolve(url)
    }).catch(reject)
  })
}
