From 4caa603251d37b59cb0278ec69709d6561d7ed39 Mon Sep 17 00:00:00 2001 From: Danh Date: Sun, 24 Sep 2023 18:26:01 +0700 Subject: [PATCH] refactor data --- src/components/swapv2/LimitOrder/LimitOrderForm.tsx | 4 ++-- src/components/swapv2/LimitOrder/useCancellingOrders.ts | 4 ++-- src/components/swapv2/LimitOrder/useFetchActiveAllOrders.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/swapv2/LimitOrder/LimitOrderForm.tsx b/src/components/swapv2/LimitOrder/LimitOrderForm.tsx index f67b3ac03c..5b500a358e 100644 --- a/src/components/swapv2/LimitOrder/LimitOrderForm.tsx +++ b/src/components/swapv2/LimitOrder/LimitOrderForm.tsx @@ -268,8 +268,8 @@ function LimitOrderForm({ } const parseInputAmount = tryParseAmount(inputAmount, currencyIn ?? undefined) - const { data, isError } = useGetLOConfigQuery(chainId) - const limitOrderContract = isError ? undefined : data?.contract || undefined + const { currentData } = useGetLOConfigQuery(chainId) + const limitOrderContract = currentData?.contract const currentAllowance = useTokenAllowance( currencyIn as Token, diff --git a/src/components/swapv2/LimitOrder/useCancellingOrders.ts b/src/components/swapv2/LimitOrder/useCancellingOrders.ts index 213226b413..8211002e02 100644 --- a/src/components/swapv2/LimitOrder/useCancellingOrders.ts +++ b/src/components/swapv2/LimitOrder/useCancellingOrders.ts @@ -20,8 +20,8 @@ export default function useCancellingOrders(): CancellingOrderInfo { const [cancellingOrdersIds, setCancellingOrdersIds] = useState([]) const [cancellingOrdersNonces, setCancellingOrdersNonces] = useState({}) const [loading, setLoading] = useState(true) - const { data, isError } = useGetLOConfigQuery(chainId) - const contract = isError ? '' : data?.contract || '' + const { currentData } = useGetLOConfigQuery(chainId) + const contract = currentData?.contract || '' const setCancellingOrders = useCallback((orderIds: number[]) => { setCancellingOrdersIds(orderIds) diff --git a/src/components/swapv2/LimitOrder/useFetchActiveAllOrders.ts b/src/components/swapv2/LimitOrder/useFetchActiveAllOrders.ts index 0a0d949b75..87f869ea6e 100644 --- a/src/components/swapv2/LimitOrder/useFetchActiveAllOrders.ts +++ b/src/components/swapv2/LimitOrder/useFetchActiveAllOrders.ts @@ -6,7 +6,7 @@ import { useActiveWeb3React } from 'hooks' export const useIsSupportSoftCancelOrder = () => { const { chainId } = useActiveWeb3React() - const { data: config } = useGetLOConfigQuery(chainId) + const { currentData: config } = useGetLOConfigQuery(chainId) return useCallback( (order: LimitOrder | undefined) => { if (!order) return false