| import { useQuery } from "@tanstack/react-query"; |
| import { fetchClientConfig } from "../api/client"; |
| import type { AppSettings } from "../utils/settings"; |
|
|
| export function useClientConfig( |
| token: string, |
| clientKey: string, |
| settings: AppSettings, |
| ) { |
| return useQuery({ |
| queryKey: [ |
| "client-config", |
| token, |
| clientKey, |
| settings.customApiBase, |
| settings.autoDevToken, |
| ], |
| queryFn: () => |
| fetchClientConfig( |
| token, |
| clientKey, |
| settings.customApiBase, |
| settings.autoDevToken, |
| ), |
| enabled: import.meta.env.DEV || Boolean(token || clientKey), |
| retry: false, |
| }); |
| } |
|
|