Last active
July 8, 2025 05:39
-
-
Save huynhducduy/1decb988ba6904cc11abacdf4748de6a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import type {UseQueryOptions} from '@tanstack/react-query' | |
| export function getDepositWithdrawalHistoryQueryKey(params: { | |
| page: number | |
| limit: number | |
| }) { | |
| return [ | |
| 'deposit-withdrawal-history', | |
| params.page, | |
| params.limit, | |
| ] as const | |
| } | |
| export function getDepositWithdrawalHistoryQueryOptions< | |
| TData = DepositWithdrawalHistoryData, | |
| TError = Error, | |
| >( | |
| params: { | |
| page: number | |
| limit: number | |
| }, | |
| options?: Omit< | |
| UseQueryOptions<DepositWithdrawalHistoryData, TError, TData>, | |
| 'queryKey' | 'queryFn' | |
| >, | |
| ) { | |
| return queryOptions({ | |
| queryKey: getDepositWithdrawalHistoryQueryKey(params), | |
| queryFn: async () => | |
| fetchDepositWithdrawalHistories( | |
| params.page, | |
| params.limit, | |
| ), | |
| refetchInterval: 10000, | |
| ...options, | |
| }) | |
| } | |
| export default function useDepositWithdrawalHistoryQuery( | |
| page: number, | |
| limit: number, | |
| ) { | |
| return useQuery( | |
| getDepositWithdrawalHistoryQueryOptions({ | |
| page, | |
| limit, | |
| }), | |
| ) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment