import request from '@/utils/request'

export function getDirectoryTree() {
  return request({
    url: '/gx/directory/front/tree',
    method: 'get'
  })
}

export function getFileList(dirId) {
  return request({
    url: '/gx/file/front/list/' + dirId,
    method: 'get'
  })
}

export function uploadFile(data) {
  return request({
    url: '/gx/file/upload',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

export function downloadFile(id) {
  return request({
    url: '/gx/file/download/' + id,
    method: 'get',
    responseType: 'blob'
  })
}

export function deleteFile(id) {
  return request({
    url: '/gx/file/' + id,
    method: 'delete'
  })
}
