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

const { request } = networkUtils;
const { api } = config;
const { item, common } = api;
const { items} = item;
const { trans } = common;

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

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

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

export async function remove(ids) {
  return request({
    url: `${items}/del`,
    method: 'post',
    data: ids,
  });
}

export async function update(params) {
  return request({
    url: `${items}/put`,
    method: 'post',
    data: params,
  });
}

export async function transCHToEn(params) {
  return request({
    url: trans.firstLetter,
    method: 'get',
    data: params,
  });
}
