세금계산서 엑셀다운로드 추가

This commit is contained in:
focp212@naver.com
2025-11-11 10:38:23 +09:00
parent f72fcf0604
commit 6bd57708cf
7 changed files with 135 additions and 15 deletions

View File

@@ -0,0 +1,39 @@
import axios from 'axios';
import { API_URL_VAT_RETURN } from '@/shared/api/api-url-vat-return';
import { resultify } from '@/shared/lib/resultify';
import { NiceAxiosError } from '@/shared/@types/error';
import {
VatReturnDownloadExcelParams,
VatReturnDownloadExcelResponse
} from '../model/types';
import {
useMutation,
UseMutationOptions
} from '@tanstack/react-query';
import { getHeaderUserAgent } from '@/shared/constants/url';
export const vatReturnDownloadExcel = (params: VatReturnDownloadExcelParams) => {
let headerOptions = {
menuId: 48,
apiType: 'SELECT'
};
let options = {
headers: {
'X-User-Agent': getHeaderUserAgent(headerOptions)
}
};
return resultify(
axios.post<VatReturnDownloadExcelResponse>(API_URL_VAT_RETURN.vatReturnDownloadExcel(), params, options),
);
};
export const useVatReturnDownloadExcelMutation = (options?: UseMutationOptions<VatReturnDownloadExcelResponse, NiceAxiosError, VatReturnDownloadExcelParams>) => {
const mutation = useMutation<VatReturnDownloadExcelResponse, NiceAxiosError, VatReturnDownloadExcelParams>({
...options,
mutationFn: (params: VatReturnDownloadExcelParams) => vatReturnDownloadExcel(params),
});
return {
...mutation,
};
};