Skip to content

Commit

Permalink
fix: switched useStore to useAuthorize (deriv-com#14131)
Browse files Browse the repository at this point in the history
  • Loading branch information
lubega-deriv authored Mar 13, 2024
1 parent c6bf825 commit 91d8afb
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions packages/hooks/src/useWalletMigration.ts
Original file line number Diff line number Diff line change
@@ -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();

Expand All @@ -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,
},
});

Expand Down

0 comments on commit 91d8afb

Please sign in to comment.