mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? Feat: Add user registration toggle feature. Added a user registration toggle REGISTER_ENABLED in the settings and .env config file. The user creation interface now checks the state of this toggle to control the enabling and disabling of the user registration feature. the front-end implementation is done, the registration button does not appear if registration is not allowed. I did the actual tests on my local server and it worked smoothly. ### Type of change - [x] New Feature (non-breaking change which adds functionality) --------- Co-authored-by: wenju.li <wenju.li@deepctr.cn> Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
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 };
|
|
};
|