Files
tehran_taj/apps/user-app/dist/assets/catalogStore-D-IZxGT6.js
T
mahmoodandClaude Sonnet 5.5 0b973f9e46 fix(app): re-check the sales-expert flag on every dashboard visit
The "سفارش مشتریان" / "مشتریان من" entries are shown from session.isSalesExpert,
which was fetched from /expert/whoami only once, at sign-in. A slow or failed
request (silently swallowed) left the flag false until the next login, so an
expert saw a customer-only menu. The dashboard now asks again on mount and on
every re-activation, and keeps the current value when the request fails.

Rebuilds user-app and user-app-v2 dist.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 10:23:08 +03:30

2 lines
729 B
JavaScript

import{s as g,W as f,K as c,X as p,h as v,i as y,y as h}from"./index-CW3p0GOu.js";const S=g("catalog",()=>{const o=f(),n=o.peek(c.catalog),t=p(n??[]),s=v(n!==void 0),r=y(()=>{const e=new Map;for(const a of t.value)a.category&&!e.has(a.category.id)&&e.set(a.category.id,{id:a.category.id,title:a.category.title});return[...e.values()]});async function i(e=!1){const a=await o.fetch(c.catalog,async()=>(await h.listProductsPaged({page:1,limit:100,sort:"newest"})).rows,{force:e});return t.value=a,s.value=!0,a}function l(e){t.value=e,s.value=!0}function u(e){return t.value.find(a=>a.id===e)??null}function d(){o.invalidate(c.catalog)}return{products:t,loaded:s,categories:r,load:i,replace:l,byId:u,invalidate:d}});export{S as u};