Files
OpenFlare/openflare-server/frontend/hooks/use-public-config.ts
T
ryan 88360350a0 refactor(repo): replace legacy openflare-server with Wavelet rename
Delete the old monolithic openflare-server implementation and rename
Wavelet/ to openflare-server/ to complete the migration consolidation.
Update CI workflows, agent Dockerfiles, and deployment docs for the new
layout (frontend/, docker/Dockerfile).
2026-06-19 11:29:17 +08:00

21 lines
558 B
TypeScript

import {useQuery} from '@tanstack/react-query'
import services from '@/lib/services'
/**
* 获取公共配置(使用 React Query 进行统一缓存与自动同步)
*
* @example
* ```tsx
* const { config, loading, error } = usePublicConfig()
* ```
*/
export function usePublicConfig() {
const { data: config, isLoading: loading, error } = useQuery({
queryKey: ['public-config'],
queryFn: () => services.config.getPublicConfig(),
staleTime: 5 * 60 * 1000, // 5 分钟缓存
})
return { config: config || null, loading, error }
}