This commit is contained in:
ryan
2026-07-13 15:17:45 +08:00
parent 08e61ce833
commit e0eb4e5975
334 changed files with 17212 additions and 12321 deletions
+9 -5
View File
@@ -1,5 +1,5 @@
import {useQuery} from '@tanstack/react-query'
import services from '@/lib/services'
import { useQuery } from '@tanstack/react-query';
import services from '@/lib/services';
/**
* 获取公共配置(使用 React Query 进行统一缓存与自动同步)
@@ -10,11 +10,15 @@ import services from '@/lib/services'
* ```
*/
export function usePublicConfig() {
const { data: config, isLoading: loading, error } = useQuery({
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 }
return { config: config || null, loading, error };
}