⚠️
Important! We’ve moved to V3! This documentation is for V2 only and will be updated in May.
Developer Hub
🔮 For applications
SDK
Data Hooks
useActiveConditions

useActiveConditions

The useActiveConditions hook is wrapper over useConditions for getting active conditions.

Usage

import { useActiveConditions } from '@azuro-org/sdk'
 
const { data, isFetching, error } = useActiveConditions(props)

Props

{
  gameId: string | bigint
  filter?: {
    outcomeIds?: string[]
    maxMargin?: number | string
  }
  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

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
            }
        }
    }>
}