/**
 * @desc 查询申请单详情
 */
import { defaultSuccess, defaultError, http } from '@/plugins/axios';
import type { AxiosResponse } from 'axios';
export default async function (
  /** 申请单ID */
  applyId: number,

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