// @ts-ignore
import ajax from '@/utils/request.js';

/**
 * 获取数据
 * @param {object} data
 * @returns
 */
export function getPageParameters(data) {
  return ajax({
    noLoad: true,
    url: '/h5operate/list',
    method: 'POST',
    errorToast: '当前访问人数过多，请重试。',
    header: {
      Authorization: localStorage.getItem('token'),
    },
    data,
  });
}

/**
 * 上传文件
 */
export function uploadFile(data) {
  return ajax({
    noLoad: true,
    url: '/h5template/upload',
    method: 'POST',
    isUpFile: true,
    header: {
      Authorization: localStorage.getItem('token'),
      contentType: 'multipart/form-data',
    },
    data,
  });
}

/**
 * 上传数据
 */
export function uploadData(data) {
  return ajax({
    url: '/h5operate/form/store',
    method: 'POST',
    header: {
      Authorization: localStorage.getItem('token'),
    },
    data,
  });
}
