import { config, networkUtils } from '../../../utils';

const { request } = networkUtils;
const { api } = config;
const { order } = api;
const { returnOrder } = order;

export async function query(params: object) {
  return request({
    url: returnOrder,
    method: 'get',
    data: params,
  });
}

export async function getSingle(id: number) {
  return request({
    url: `${returnOrder}/${id}`,
    method: 'get',
  });
}

export async function create(params: object) {
  return request({
    url: returnOrder,
    method: 'post',
    data: params,
  });
}

export async function remove(ids: number[]) {
  return request({
    url: returnOrder,
    method: 'delete',
    data: ids,
  });
}

export async function update(params: object) {
  return request({
    url: returnOrder,
    method: 'put',
    data: params,
  });
}
