/**
 * @desc 获取盘点结果数据
 */
import { defaultSuccess, defaultError, http } from '@/plugins/axios';
import type { AxiosResponse } from 'axios';
export default async function (
  /** 申请单ID */
  applyId: string,

  success: (data: material.ComparisonResDTO) => void = defaultSuccess,
  fail: (error: { code: string; error?: string }) => void = defaultError,
): Promise<void> {
  return http({
    method: 'get',
    url: `/comparison-result/${applyId}`,
  })
    .then((data: AxiosResponse<material.ComparisonResDTO, unknown>) => {
      success(data.data);
    })
    .catch((error: { code: string; error?: string }) => fail(error));
}
