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