import request from '@/utils/request';

// 保存or更新
export async function saveOrEdit (data) {
  const res = await request.post(`/main/identityphoto/saveOrUpdate`, data);
  if (res.data.code == 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 获取证照列表分页
export async function getPhotoList (data) {
  let par = new URLSearchParams(data);
  const res = await request.get(`/main/identityphoto/page?` + par, {});
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 获取证照信息详情
export async function getPhotoInfo (id) {
  const res = await request.get(`/main/identityphoto/getById/${id}`);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
