import{al as w,r as n,am as r,an as a}from"./index-CipWZKo_.js";const j=w("content",()=>{const s=n([]),c=n([]),i=n([]),p=n([]),o=n([]);async function h(){let t="error";return await r.post(a.news,{},{headers:{"Content-Type":"application/json"}}).then(e=>{e?.headers?.["content-type"]!=="text/html; charset=utf-8"?s.value=e?.data:t="error"}).catch(()=>{t="error"}),t}async function l(){let t="error";return await r.post(a.contacts,{},{headers:{"Content-Type":"application/json"}}).then(e=>{e?.headers?.["content-type"]!=="text/html; charset=utf-8"?p.value=e?.data:t="error"}).catch(()=>{t="error"}),t}async function u(){let t="error";return await r.post(a.partners,{},{headers:{"Content-Type":"application/json"}}).then(e=>{e?.headers?.["content-type"]!=="text/html; charset=utf-8"?c.value=e?.data:t="error"}).catch(()=>{t="error"}),t}async function f(){let t="error";return await r.post(a.clients,{},{headers:{"Content-Type":"application/json"}}).then(e=>{e?.headers?.["content-type"]!=="text/html; charset=utf-8"?i.value=e?.data:t="error"}).catch(()=>{t="error"}),t}async function d(){try{const t=await r.get(a.content,{headers:{"Content-Type":"application/json"}});if(t.status===200&&t.data)o.value=t.data;else throw new Error("Некорректный ответ сервера")}catch(t){console.error("Ошибка при запросе к API:",t)}}function y(t){const e=t.join("/");return Object.values(o.value).find(m=>m.Partition===e)}return{newsList:s,partnersList:c,clientsList:i,documentsList:o,contacts:p,fetchContacts:l,fetchNews:h,fetchPartners:u,fetchClients:f,fetchDocuments:d,getDocumentByPartition:y}});export{j as u};
