fix(auth): secure sessions and app routing
Validate sessions against the API, honor configurable base paths, and route unknown pages to 404. Keep development ports stable so user and admin apps cannot be confused. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
+1
@@ -0,0 +1 @@
|
||||
import{L as e,Q as t,bt as n,it as r,lt as i,yt as a,z as o}from"./index-B2VD3zy8.js";import{t as s}from"./BaseSwitch-dp2xMemS.js";function c(e=480){return new Promise(t=>{window.setTimeout(t,e)})}function l(e){let t=a(null),n=a(null),r=o();async function i(i,a){if(t.value)return a;let o=!a;if(!o&&e.confirmOff&&!await e.confirmOff())return a;t.value=i,n.value=null;let s=a;try{return await e.onPersist(o),r.success(e.successMessage?.(o)??(o?`وضعیت فعال شد.`:`وضعیت غیرفعال شد.`)),o}catch{return n.value=i,r.error(e.errorMessage??`بهروزرسانی وضعیت انجام نشد.`),s}finally{t.value=null}}function s(e){return t.value===e}function c(e){return n.value===e}return{toggle:i,isLoading:s,hasError:c}}var u=r({__name:`ActiveSwitchCell`,props:{id:{},modelValue:{type:Boolean},entityName:{},entityType:{},persist:{type:Function}},emits:[`update:modelValue`],setup(r,{emit:a}){let o=r,u=a,{toggle:d,isLoading:f,hasError:p}=l({onPersist:async e=>{o.persist?await o.persist(o.id,e):await c()},successMessage:e=>e?`${o.entityType??`مورد`} «${o.entityName}» فعال شد.`:`${o.entityType??`مورد`} «${o.entityName}» غیرفعال شد.`});async function m(t){if(t===o.modelValue)return;let n=o.entityType??`مورد`;if(!await e({title:t?`فعالسازی ${n}`:`غیرفعالسازی ${n}`,message:t?`آیا از فعال کردن «${o.entityName}» مطمئن هستید؟`:`آیا از غیرفعال کردن «${o.entityName}» مطمئن هستید؟`,tone:t?`primary`:`danger`,confirmLabel:t?`فعال کردن`:`غیرفعال کردن`,cancelLabel:`انصراف`}))return;let r=await d(o.id,o.modelValue);u(`update:modelValue`,r)}return(e,a)=>(i(),t(s,{"model-value":r.modelValue,loading:n(f)(r.id),error:n(p)(r.id),"onUpdate:modelValue":m},null,8,[`model-value`,`loading`,`error`]))}});export{u as t};
|
||||
Reference in New Issue
Block a user