mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-22 16:36:47 +08:00
19 lines
588 B
TypeScript
19 lines
588 B
TypeScript
|
|
import userService from '@/services/user-service';
|
||
|
|
import { useQuery } from '@tanstack/react-query';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Hook to fetch system configuration including register enable status
|
||
|
|
* @returns System configuration with loading status
|
||
|
|
*/
|
||
|
|
export const useSystemConfig = () => {
|
||
|
|
const { data, isLoading } = useQuery({
|
||
|
|
queryKey: ['systemConfig'],
|
||
|
|
queryFn: async () => {
|
||
|
|
const { data = {} } = await userService.getSystemConfig();
|
||
|
|
return data.data || { registerEnabled: 1 }; // Default to enabling registration
|
||
|
|
},
|
||
|
|
});
|
||
|
|
|
||
|
|
return { config: data, loading: isLoading };
|
||
|
|
};
|