import { useEffect } from 'react'; import { useRequest } from 'umi'; import { queryRoleList } from '../server'; const useSelectRole = ({ appId, isAllowApply }) => { const { data: roleList, run, loading, } = useRequest(queryRoleList, { manual: true, }); useEffect(() => { if (appId && isAllowApply) { run?.(appId, isAllowApply); } }, [appId, isAllowApply]); return { loading, roleList }; }; export default useSelectRole;