import{aj as O,r as l,y as s,z as a}from"./index-Bb2UEb_P.js";const h=O("orders",()=>{const t=l({}),o=l([]);async function u(){try{const{data:r}=await s.get(a.orders);t.value=r||{},o.value=r?Object.values(r):[]}catch(r){console.error("Ошибка при загрузке заказов:",r),t.value={},o.value=[]}}async function d(r){try{const{data:e}=await s.get(a.orders,{params:{ID:r}});return e.length===0?null:e}catch(e){return console.error("Ошибка при загрузке заказа:",e),null}}async function i(r,e){let n="ERROR",f=null;try{(await s.post(a.autoProlongOrder,{IsAutoProlong:r?1:0,OrderID:e})).data?.Status==="Ok"&&(n="SUCCESS")}catch(c){console.error(c)}return{result:n,error:f}}return{orders:t,ordersList:o,fetchAllOrders:u,fetchOneOrder:d,autoProlong:i}});export{h as u};
