Files
hedena_gold/apps/user-app/dist/assets/IamCallback-DB-YqINX.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
963 B
JavaScript

import{d as c,T as i,o as m,y as r,c as l,G as _,b as p}from"./index-CW3p0GOu.js";const g={style:{"min-height":"100vh",display:"grid","place-items":"center"}},h=c({__name:"IamCallback",setup(u){const a=_(),s=i();function o(){sessionStorage.setItem("gb_iam_sso_skip","1");const e=sessionStorage.getItem("gb_iam_return");sessionStorage.removeItem("gb_iam_return");const t=e&&e.startsWith("/")&&!e.startsWith("//")?e:"/";return a.replace(t)}return m(async()=>{const e=new URLSearchParams(window.location.search);if(sessionStorage.removeItem("gb_iam_sso_checked"),e.get("error")||!e.get("code")||!e.get("state")){await o();return}try{const t=await r.ssoCallback(e.get("code"),e.get("state"));s.login(t.token,t.customer.id,t.customer.mobile);try{const n=await r.getExpertIdentity();s.setSalesExpert(n.isSalesExpert)}catch{s.setSalesExpert(!1)}await a.replace({name:"home"})}catch{await o()}}),(e,t)=>(p(),l("div",g,"در حال ورود..."))}});export{h as default};