Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 2x 31x 2x 2x 25x 2x | import { useQuery } from '@tanstack/react-query';
import { fetchConversionRates } from '../services/conversion-rate.service';
// Query keys for React Query
export const conversionRateKeys = {
all: ['conversion-rates'] as const,
lists: () => [...conversionRateKeys.all, 'list'] as const,
list: (filters: Record<string, any>) =>
[...conversionRateKeys.lists(), { filters }] as const,
};
// Hook to fetch conversion rates
export const useConversionRates = () => {
return useQuery({
queryKey: conversionRateKeys.lists(),
queryFn: fetchConversionRates,
});
};
// Combined hook for conversion rate operations (backward compatibility)
export const useConversionRateOperations = () => {
const { data, isLoading, error, refetch } = useConversionRates();
return {
data: data || [],
loading: isLoading,
error: error?.message || null,
refetch,
};
};
|