2024-09-24 23:00:01 +02:00
|
|
|
import { fetchApi } from './fetchApi'
|
|
|
|
|
import { keys } from './queryKeys'
|
|
|
|
|
import { useQuery } from '@tanstack/react-query'
|
2025-04-10 18:39:36 +02:00
|
|
|
import { RecordingMode } from '@/features/recording'
|
2024-11-13 19:14:59 +01:00
|
|
|
|
2024-09-24 23:00:01 +02:00
|
|
|
export interface ApiConfig {
|
|
|
|
|
analytics?: {
|
|
|
|
|
id: string
|
|
|
|
|
host: string
|
|
|
|
|
}
|
|
|
|
|
support?: {
|
|
|
|
|
id: string
|
|
|
|
|
}
|
|
|
|
|
silence_livekit_debug_logs?: boolean
|
2025-04-16 20:51:06 +02:00
|
|
|
is_silent_login_enabled?: boolean
|
2024-11-13 19:14:59 +01:00
|
|
|
recording?: {
|
|
|
|
|
is_enabled?: boolean
|
|
|
|
|
available_modes?: RecordingMode[]
|
|
|
|
|
}
|
2024-09-24 23:00:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const fetchConfig = (): Promise<ApiConfig> => {
|
|
|
|
|
return fetchApi<ApiConfig>(`config/`)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const useConfig = () => {
|
|
|
|
|
return useQuery({
|
|
|
|
|
queryKey: [keys.config],
|
|
|
|
|
queryFn: fetchConfig,
|
|
|
|
|
staleTime: Infinity,
|
|
|
|
|
})
|
|
|
|
|
}
|