Developer Hub
🔮 For applications
SDK
Data Hooks
useActiveConditions

Wrapper over useConditions for getting active conditions.

Usage

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

Props

{
  gameId: string
  isLive: boolean // if the flag is set to true, useConditions will retrieve live conditions.
  filter?: {
    outcomeIds?: string[]
    maxMargin?: number // max marginality
  }
  livePollInterval?: 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**
}
⚠️

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, games } = useGames()
 
const gameId = games?.[0]?.gameId

Return Value

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