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