import{al as O,r as u,am as r,an as s}from"./index-CipWZKo_.js";const m=O("hosting",()=>{const o=u({}),i=u(null);async function c(){try{const t=await r.post(s.hostingOrders);t?.data?o.value=t.data:o.value={}}catch(t){console.error("Ошибка при загрузке заказов хостинга:",t),o.value={}}}async function d(){if(i.value)return;const t=await r.post(s.hostingSchemes);i.value=t.data}async function h(t){let e="ERROR",n=null,a=null;return await r.post(s.HostingOrder,t).then(l=>{l?.data?.Status==="Ok"?(e="SUCCESS",a=l?.data):n=l?.data?.Exception}),{result:e,info:a,error:n}}async function S(t){let e="ERROR",n=null;return await r.post(s.HostingOrderPay,t).then(a=>{a?.data?.Status==="Ok"?e="SUCCESS":a?.data?.Status==="UseBasket"?e="BASKET":n=a?.data?.Exception}),{result:e,error:n}}async function f(t){let e="ERROR",n=null;return await r.post(s.HostingOrderSchemeChange,t).then(a=>{a?.data?.Status==="Ok"&&(e="SUCCESS")}),{result:e,error:n}}async function g(t){const e=await r.get(s.hostingOrders,{params:{OrderID:t}});return e.data.ID?e.data:null}return{hostingList:o,hostingSchemes:i,fetchHostingOrder:g,fetchHostingOrders:c,fetchHostingSchemes:d,HostingOrder:h,HostingOrderPay:S,HostingOrderSchemeChange:f}});export{m as u};
