빌키 에스크로 추가 api 연ㄱㅕㄹ
This commit is contained in:
29
src/entities/transaction/api/use-billing-charge-mutation.ts
Normal file
29
src/entities/transaction/api/use-billing-charge-mutation.ts
Normal file
@@ -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 {
|
||||
BillingChargeParams,
|
||||
BillingChargeResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const billingCharge = (params: BillingChargeParams) => {
|
||||
return resultify(
|
||||
axios.post<BillingChargeResponse>(API_URL.billingDetail(), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const useBillingChargeMutation = (options?: UseMutationOptions<BillingChargeResponse, CBDCAxiosError, BillingChargeParams>) => {
|
||||
const mutation = useMutation<BillingChargeResponse, CBDCAxiosError, BillingChargeParams>({
|
||||
...options,
|
||||
mutationFn: (params: BillingChargeParams) => billingCharge(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user