From ba86416af5b75ad0416b0893a35823eb9738b550 Mon Sep 17 00:00:00 2001 From: thisyahlen <104053934+thisyahlen-deriv@users.noreply.github.com> Date: Fri, 26 Jul 2024 10:13:33 +0800 Subject: [PATCH] chore: add useBuy hook (#68) --- src/api/mutation/index.tsx | 2 ++ src/api/mutation/use-buy.tsx | 11 +++++++++++ 2 files changed, 13 insertions(+) create mode 100644 src/api/mutation/use-buy.tsx diff --git a/src/api/mutation/index.tsx b/src/api/mutation/index.tsx index 24636c4..24fc26f 100644 --- a/src/api/mutation/index.tsx +++ b/src/api/mutation/index.tsx @@ -8,6 +8,7 @@ import { useAppDelete } from './use-app-delete'; import { useAppRegister } from './use-app-register'; import { useAppUpdate } from './use-app-update'; import { useAuthorize } from './use-authorize'; +import { useBuy } from './use-buy'; import { useBuyContractForMultipleAccounts } from './use-buy-contract-for-multiple-accounts'; import { useCancel } from './use-cancel'; import { useCashierWithdrawalCancel } from './use-cashier-withdrawal-cancel'; @@ -87,6 +88,7 @@ export { useAppRegister, useAppUpdate, useAuthorize, + useBuy, useBuyContractForMultipleAccounts, useCancel, useCashierWithdrawalCancel, diff --git a/src/api/mutation/use-buy.tsx b/src/api/mutation/use-buy.tsx new file mode 100644 index 0000000..ac319c0 --- /dev/null +++ b/src/api/mutation/use-buy.tsx @@ -0,0 +1,11 @@ +import { useMutation } from '../../base'; +import { AugmentedMutationOptions } from '../../base/use-mutation'; + +export const useBuy = ({ ...props }: Omit, 'name'> = {}) => { + const { data, ...rest } = useMutation({ name: 'buy', ...props }); + + return { + data: data?.buy, + ...rest, + }; +};