This commit is contained in:
@@ -48,9 +48,23 @@ const getActiveLeagues = (sport?: string) => {
|
||||
});
|
||||
};
|
||||
|
||||
export type OddsMovementDto = Record<
|
||||
string,
|
||||
Record<string, { open: number; close: number }>
|
||||
>;
|
||||
|
||||
const getOddsMovement = (id: string) => {
|
||||
return apiRequest<ApiResponse<OddsMovementDto>>({
|
||||
url: `/matches/${id}/odds-movement`,
|
||||
client: "core",
|
||||
method: "get",
|
||||
});
|
||||
};
|
||||
|
||||
export const matchesService = {
|
||||
listMatches,
|
||||
getMatchDetails,
|
||||
queryMatches,
|
||||
getActiveLeagues,
|
||||
getOddsMovement,
|
||||
};
|
||||
|
||||
@@ -7,6 +7,8 @@ export const MatchesQueryKeys = {
|
||||
list: (params?: MatchListParams) =>
|
||||
[...MatchesQueryKeys.all, "list", params] as const,
|
||||
detail: (id: string) => [...MatchesQueryKeys.all, "detail", id] as const,
|
||||
oddsMovement: (id: string) =>
|
||||
[...MatchesQueryKeys.all, "oddsMovement", id] as const,
|
||||
activeLeagues: (sport?: string) =>
|
||||
[...MatchesQueryKeys.all, "activeLeagues", sport] as const,
|
||||
};
|
||||
@@ -26,6 +28,14 @@ export const useMatchDetails = (id: string) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const useOddsMovement = (id: string) => {
|
||||
return useQuery({
|
||||
queryKey: MatchesQueryKeys.oddsMovement(id),
|
||||
queryFn: () => matchesService.getOddsMovement(id),
|
||||
enabled: !!id,
|
||||
});
|
||||
};
|
||||
|
||||
export const useQueryMatches = () => {
|
||||
return useMutation({
|
||||
mutationFn: (queryDto: MatchQueryDto) =>
|
||||
|
||||
Reference in New Issue
Block a user