di usage in website

This commit is contained in:
2026-01-06 19:36:03 +01:00
parent 589b55a87e
commit e589c30bf8
191 changed files with 6367 additions and 4253 deletions

View File

@@ -0,0 +1,28 @@
'use client';
import { useQuery } from '@tanstack/react-query';
import { useInject } from '@/lib/di/hooks/useInject';
import { DRIVER_SERVICE_TOKEN } from '@/lib/di/tokens';
/**
* Hook for driver leaderboard data
*/
export function useDriverLeaderboard() {
const driverService = useInject(DRIVER_SERVICE_TOKEN);
const query = useQuery({
queryKey: ['driverLeaderboard'],
queryFn: async () => {
return await driverService.getDriverLeaderboard();
},
staleTime: 5 * 60 * 1000, // 5 minutes
gcTime: 10 * 60 * 1000, // 10 minutes
});
return {
data: query.data,
isLoading: query.isLoading,
error: query.error,
retry: query.refetch,
};
}