From f407c78284e03f4110554b57e01a54d79acc0268 Mon Sep 17 00:00:00 2001 From: yjin Date: Mon, 23 Dec 2024 17:49:48 +0900 Subject: [PATCH] fix: [GSW-1987] Improve SwapRoute FE --- .../src/react-query/router/use-get-routes.ts | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/packages/web/src/react-query/router/use-get-routes.ts b/packages/web/src/react-query/router/use-get-routes.ts index 84ef6ab5c..514a49ce7 100644 --- a/packages/web/src/react-query/router/use-get-routes.ts +++ b/packages/web/src/react-query/router/use-get-routes.ts @@ -4,7 +4,6 @@ import { SwapError } from "@common/errors/swap"; import { useGnoswapContext } from "@hooks/common/use-gnoswap-context"; import { TokenModel } from "@models/token/token-model"; import { GetRoutesResponse } from "@repositories/swap/response/get-routes-response"; -import { wait } from "@utils/common"; import { QUERY_KEY } from "../query-keys"; @@ -39,21 +38,17 @@ export const useGetRoutes = ( const outputToken = request.outputToken; const tokenAmount = Number(request.tokenAmount); - const result = await wait( - async () => - swapRouterRepository - .getRoutes({ - inputToken, - outputToken, - exactType: request.exactType, - tokenAmount, - }) - .catch(e => { - console.error(e); - return null; - }), - 300, - ); + const result = await swapRouterRepository + .getRoutes({ + inputToken, + outputToken, + exactType: request.exactType, + tokenAmount, + }) + .catch(e => { + console.error(e); + return null; + }); if (!result) { throw new SwapError("NOT_FOUND_SWAP_POOL"); @@ -67,7 +62,7 @@ export const useGetRoutes = ( return result; }, - // retry: false, + retry: false, refetchInterval: REFETCH_INTERVAL, staleTime: STALE_TIME, enabled: !!request?.inputToken?.path && !!request?.outputToken?.path,