import request from '@/utils/request';

/**
 * 上传文件
 *
 * @param file
 */
export function uploadFile(file: File) {
  const formData = new FormData();
  formData.append('file', file);
  return request({
    url: 'admin/common/upload/oss/image',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  });
}

/**
 * 删除文件
 *
 * @param path
 */
export function deleteFile(path?: string) {
  return request({
    url: 'admin/common/delete/oss/image',
    method: 'delete',
    params: { path: path },
  });
}
