Liferay.Loader.define("layout-admin-web@5.0.84/js/AddLayout",["module","exports","require"],(function(e,t,a){window;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function({namespace:e}){const t=document.getElementById("".concat(e,"addButton")),a=document.getElementById("".concat(e,"fm"));a.addEventListener("submit",(o=>{if(o.preventDefault(),o.stopPropagation(),t.disabled)return;t.disabled=!0;const n=new FormData(a);Liferay.Util.fetch(a.action,{body:n,method:"POST"}).then((e=>e.json())).then((a=>{if(a.redirectURL){const t=new URL(a.redirectURL,window.location.origin);t.searchParams.set("p_p_state","normal");Liferay.Util.getOpener().Liferay.fire("closeModal",{id:"".concat(e,"addLayoutDialog"),redirect:t.toString()})}else Liferay.Util.openToast({message:a.errorMessage,type:"danger"}),t.disabled=!1}))}))}}));
//# sourceMappingURL=AddLayout.js.map