2 lines
984 B
JavaScript
2 lines
984 B
JavaScript
import{d as u,d1 as d,u as p,H as m,o as f,dy as _,aB as n,g,z as v,G as w}from"./kLSCkWOg.js";import{f as x,l as c,p as o,o as F,m as R,a as b,b as k,c as a,r as B}from"./BPWrvMgj.js";const S=u({__name:"index",setup(C){const s=d(),i=p(),l=m();return f(async()=>{if(x(s.name)){c.value=!0;let{product:e}=await _(s.params?.id);c.value=!1,o.value=n(e),e.original_image&&(F.value={url:l.useDataStorage(e.original_image),index:0}),e.files?.splice(0,1),e.files&&(R.value=e.files?.map((r,t)=>({url:l.useDataStorage(r.url),index:t+1}))),b.value=n(k.value),delete o.value.brands,delete o.value.comments,delete o.value.likes,Object.assign(a,o.value),a?.collections?.parent_id||(a.collections=a?.collections??{},a.collections.parent_id=a?.collections?.id,a.collections.id=void 0),await i.replace({name:"edit-product-id-infProduct",params:s.params})}else B(),await i.replace({name:"add-product-inputProduct",params:s.params})}),(e,r)=>{const t=g("RouterView");return v(),w(t)}}});export{S as _};
|