거래내역 관련
This commit is contained in:
29
src/entities/transaction/api/use-escrow-list-mutation.ts
Normal file
29
src/entities/transaction/api/use-escrow-list-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 {
|
||||
EscrowListParams,
|
||||
EscrowListResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const escrowList = (params: EscrowListParams) => {
|
||||
return resultify(
|
||||
axios.post<EscrowListResponse>(API_URL.escrowList(), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const useEscrowListMutation = (options?: UseMutationOptions<EscrowListResponse, CBDCAxiosError, EscrowListParams>) => {
|
||||
const mutation = useMutation<EscrowListResponse, CBDCAxiosError, EscrowListParams>({
|
||||
...options,
|
||||
mutationFn: (params: EscrowListParams) => escrowList(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user