useConditions
The useConditions
hook is used to fetch Conditions
of a specific game.
ℹ️
Hook represents a logic wrapper over TanStack Query's useQuery
hook. Explore TanStack Query docs (opens in a new tab) to understand what data the hook returns.
Usage
import { useConditions } from '@azuro-org/sdk'
const { data, isFetching, error } = useConditions(props)
Props
{
gameId: string | bigint
filter?: Condition_Filter
orderBy?: Condition_OrderBy
orderDir?: OrderDirection
query?: QueryParameter<ConditionsQuery['conditions']> // useQuery params
}
⚠️
gameId
property is not the same as id
. Each game fetched using useGames
hook contains the gameId:
import { useGame } from '@azuro-org/sdk'
const { data: games } = useGames()
const gameId = games[0]?.gameId
const { data } = useConditions({ gameId })
Return Value
UseQueryResult<ConditionsQuery['conditions']>
import { type UseQueryResult } from '@tanstack/react-query'
type ConditionsQuery = {
__typename?: 'Query'
conditions: Array<{
__typename?: 'Condition'
wonOutcomeIds?: Array<string> | null
id: string
conditionId: string
state: Types.ConditionState
title?: string | null
isExpressForbidden: boolean
isPrematchEnabled: boolean
isLiveEnabled: boolean
margin: string
outcomes: Array<{
__typename?: 'Outcome'
title?: string | null
outcomeId: string
odds: string
}>
game: {
__typename?: 'Game'
gameId: string
sport: {
__typename?: 'Sport'
sportId: string
}
}
}>
}