ragflow/web/src/hooks/use-system-request.ts
balibabu ba6e2af5fd
Feat: Delete useless request hooks. #10427 (#11659)
### What problem does this PR solve?

Feat: Delete useless request hooks. #10427

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
2025-12-02 17:24:29 +08:00

18 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 };
};