Developer Hub
🔮 For applications
SDK
Data Hooks
useConditions

This hook is used to fetch pre-match and live Conditions of a specific game.

Hook represents a logic wrapper over standard Apollo's useQuery hook. Explore Apollo's docs (opens in a new tab) to understand what data the hooks return.

Usage

import { useConditions } from '@azuro-org/sdk'
 
const { loading, error, prematchConditions, liveConditions } = useConditions(props)

Props

{
  gameId: string | bigint
  livePollInterval?: number
  filter?: Condition_Filter
  prematchQuery?: QueryProps
  liveQuery?: QueryProps
}
type QueryProps = {
  pollInterval?: number // live conditions could be created at any time, and here, you can specify how frequently to check for new live conditions **measured in milliseconds**
  skip?: boolean
}
⚠️

gameId property is not the same as id. Each game fetched using useGames hook contains the gameId:

import { useGame } from '@azuro-org/sdk'
 
const { loading, error, data } = useGames()
 
const gameId = data?.games[0]?.gameId
 
const {} = useConditions({ gameId })

Return Value

import { type PrematchConditionsQuery, type LiveConditionsQuery } from '@azuro-org/toolkit'
 
{
  loading: boolean
  error: Error | null
  prematchCnditions: PrematchConditionsQuery['conditions'] | undefined,
  liveCnditions: LiveConditionsQuery['conditions'] | undefined,
}