mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-01 22:46:38 +08:00
63cd906cfc
- Merge all files inside openflare-server to the repository root directory. - Relocate agent, relay, and flared subprojects from internal/ to internal/apps/. - Combine docker-compose files and update build context paths to root. - Update GitHub workflows and Dockerfiles to refer to new directories and package names. - Rewrite Go package imports across all files. - Resolve database renew test race condition and clean up docs.
21 lines
558 B
TypeScript
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 }
|
|
}
|