거래내역 관련
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL } from '@/shared/api/urls';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
CashReceiptListParams,
|
||||
CashReceiptListResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const cashReceiptList = (params: CashReceiptListParams) => {
|
||||
return resultify(
|
||||
axios.post<CashReceiptListResponse>(API_URL.cashReceiptList(), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const useCashReceiptListMutation = (options?: UseMutationOptions<CashReceiptListResponse, CBDCAxiosError, CashReceiptListParams>) => {
|
||||
const mutation = useMutation<CashReceiptListResponse, CBDCAxiosError, CashReceiptListParams>({
|
||||
...options,
|
||||
mutationFn: (params: CashReceiptListParams) => cashReceiptList(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user