Skip to content

Commit 91d8afb

Browse files
authored
fix: switched useStore to useAuthorize (deriv-com#14131)
1 parent c6bf825 commit 91d8afb

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

packages/hooks/src/useWalletMigration.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
import { useCallback } from 'react';
22
import { useFetch, useInvalidateQuery, useRequest } from '@deriv/api';
3-
import { useStore } from '@deriv/stores';
3+
import useAuthorize from './useAuthorize';
44

55
/** A custom hook to get the status of wallet_migration API and to start/reset the migration process
66
* @deprecated This hook is deprecated. Please use the hook from @deriv/api instead.
77
*/
88
const useWalletMigration = () => {
9-
// TODO: delete it later, it's a temporary solution
10-
// because we have to check for authorize from client store before doing API call
11-
// This hook will be refactored later for subscribe when BE is ready
12-
const { client } = useStore();
13-
const { is_authorize } = client;
9+
const { isSuccess } = useAuthorize();
1410

1511
const invalidate = useInvalidateQuery();
1612

@@ -22,7 +18,7 @@ const useWalletMigration = () => {
2218
payload: { wallet_migration: 'state' },
2319
options: {
2420
refetchInterval: response => (response?.wallet_migration?.state === 'in_progress' ? 500 : false),
25-
enabled: is_authorize,
21+
enabled: isSuccess,
2622
},
2723
});
2824

0 commit comments

Comments
 (0)