Liferay.Loader.define("@liferay/analytics-settings-web@5.0.47/js/utils/useRequest",["module","exports","require","liferay!frontend-js-react-web$react"],(function(e,r,t){window;{Object.defineProperty(r,"__esModule",{value:!0}),r.useLazyRequest=function useLazyRequest(e,r){const[t,{data:a,error:n,loading:s}]=useInternalRequest(e,r);return[t,{data:a,error:n,loading:s}]},r.useRequest=function useRequest(e,r){const[t,{data:n,error:s,loading:u}]=useInternalRequest(e,r);return(0,a.useEffect)((()=>{t()}),[t]),{data:n,error:s,loading:u,refetch:t}};var a=t("liferay!frontend-js-react-web$react");function useInternalRequest(e,r){const[t,n]=(0,a.useState)(null),[s,u]=(0,a.useState)(!1),[o,i]=(0,a.useState)(!1);return[(0,a.useCallback)((async()=>{i(!0);const t=await e(r);try{if(t.error)throw t.error;n(t)}catch(e){console.error(e),u(!0)}i(!1)}),[e,JSON.stringify(r)]),{data:t,error:s,loading:o}]}}}));
//# sourceMappingURL=useRequest.js.map