// 格式化表格获取数据接口的返回
export const fetchTableData = async (
  fetch: (params: any) => Promise<any>,
  params: any,
  formatObj: any = {},
) => {
  params.page = params.current;
  params.size = params.pageSize;
  delete params.current;
  delete params.pageSize;
  const res = (await fetch(params)) || {};
  const data = res.items;
  data?.forEach((n: any) => {
    for (const key in formatObj) {
      n[key] = n[formatObj[key]];
    }
  });
  return {
    success: true,
    data: data,
    total: res.total,
  };
};
