Files
tehran_taj/apps/user-app/dist/assets/NewestView-CLPa-azY.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
2.7 KiB
JavaScript

import{P as w}from"./PageBar-DMRK3EvR.js";import{d as m,b as l,c,q as n,m as r,L as P,M as x,N as S,n as k,O as M,P as _,H as v,g as h,h as p,Q as C,R as E,C as f,F as L,r as b,E as A,_ as B}from"./index-CW3p0GOu.js";import{S as N}from"./SectionHead-BqQT521D.js";import{P as $}from"./ProductCard-C25sOeqt.js";import{u as F,C as V}from"./usePagedProducts-B-5bSdk2.js";const H={class:"flex justify-center items-center empty"},I=m({__name:"EmptyState",props:{description:{},image:{}},setup(e){return(t,s)=>(l(),c("div",H,[n(r(P),{description:"موردی یافت نشد",image:e.image,class:"h-[200px] w-[200px] opacity-70"},null,8,["image"])]))}}),T="/assets/favoritEmpty-kbtPAdi5.svg",D=m({__name:"ScrollFetchSearch",props:{loading:{type:Boolean},flag:{type:Boolean},padding:{}},emits:["fetch"],setup(e,{emit:t}){const s=t,i=x(),a=p(null);return S(a,()=>{s("fetch")},{distance:50}),(o,d)=>(l(),c("main",{class:"flex flex-col flex-1 overflow-auto no-scrollbar w-[100vw] max-w-screen-md m-auto",style:k({paddingTop:e.padding||r(i).headerHeight+"px"}),ref_key:"scrollArea",ref:a},[M(o.$slots,"default"),n(_,{cls:"my-[10px]",spinning:e.loading,indicator:!0,tip:"درحال دریافت اطلاعات"},null,8,["spinning"]),e.flag?(l(),v(I,{key:0,image:r(T)},null,8,["image"])):h("",!0)],4))}});function G(){const e=F(),t=C({totalPages:0,productList:[],flag:!1});function s(){t.productList=e.rows.value,t.totalPages=Math.ceil(e.total.value/V)||0,t.flag=e.total.value<1&&!e.loading.value}return{productsData:t,getProducts:async(a,o=!1,d=!1)=>{if(o){if(!e.hasMore.value||e.loadingMore.value)return;a.value=!0;try{await e.loadMore({sort:"newest"}),s()}catch(u){console.log(u)}finally{a.value=!1}return}a.value=!0;try{await e.resetAndLoad({sort:"newest"}),s()}catch(u){console.log(u)}finally{a.value=!1}},hasMore:e.hasMore}}const O={class:"newest"},j={key:0,class:"newest__grid"},q=m({__name:"NewestView",setup(e){const{productsData:t,getProducts:s,hasMore:i}=G(),a=p(!1),o=p(!1);E(async()=>{await s(a,!1)});const d=async()=>{o.value||!i.value||await s(o,!0)};return(u,z)=>{const y=A("container");return l(),c("div",O,[n(w,{title:"جدیدترین محصولات","back-to":"home"}),n(_,{spinning:a.value,tip:"درحال دریافت اطلاعات"},{default:f(()=>[n(D,{class:"newest__scroll",loading:o.value,flag:r(t).flag,padding:"0px",onFetch:d},{default:f(()=>[n(y,{class:"newest__body"},{default:f(()=>[n(N,{title:"تازه‌ها",subtitle:"آخرین افزوده‌های مجموعه"}),r(t).productList.length?(l(),c("div",j,[(l(!0),c(L,null,b(r(t).productList,g=>(l(),v($,{key:g.id,value:g},null,8,["value"]))),128))])):h("",!0)]),_:1})]),_:1},8,["loading","flag"])]),_:1},8,["spinning"])])}}}),U=B(q,[["__scopeId","data-v-ff00eb02"]]);export{U as default};