From 91d8afbfd13d0c9c09849ab4e02d380739d96e78 Mon Sep 17 00:00:00 2001 From: lubega-deriv <142860499+lubega-deriv@users.noreply.github.com> Date: Wed, 13 Mar 2024 18:19:16 +0800 Subject: [PATCH] fix: switched useStore to useAuthorize (#14131) --- packages/hooks/src/useWalletMigration.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/hooks/src/useWalletMigration.ts b/packages/hooks/src/useWalletMigration.ts index 0c00a2fed715..615da759f6c2 100644 --- a/packages/hooks/src/useWalletMigration.ts +++ b/packages/hooks/src/useWalletMigration.ts @@ -1,16 +1,12 @@ import { useCallback } from 'react'; import { useFetch, useInvalidateQuery, useRequest } from '@deriv/api'; -import { useStore } from '@deriv/stores'; +import useAuthorize from './useAuthorize'; /** A custom hook to get the status of wallet_migration API and to start/reset the migration process * @deprecated This hook is deprecated. Please use the hook from @deriv/api instead. */ const useWalletMigration = () => { - // TODO: delete it later, it's a temporary solution - // because we have to check for authorize from client store before doing API call - // This hook will be refactored later for subscribe when BE is ready - const { client } = useStore(); - const { is_authorize } = client; + const { isSuccess } = useAuthorize(); const invalidate = useInvalidateQuery(); @@ -22,7 +18,7 @@ const useWalletMigration = () => { payload: { wallet_migration: 'state' }, options: { refetchInterval: response => (response?.wallet_migration?.state === 'in_progress' ? 500 : false), - enabled: is_authorize, + enabled: isSuccess, }, });