Ajuste Layout, Dashboard Terapeuta, Timeline, Suporte técnico, Documentação e FAQ
This commit is contained in:
@@ -396,6 +396,32 @@ export function applyGuards (router) {
|
||||
// ======================================
|
||||
const isAccountArea = (to.path === '/account' || to.path.startsWith('/account/'))
|
||||
if (isAccountArea) {
|
||||
// Garante menu + entitlements ao recarregar diretamente em /account/* (ex.: F5).
|
||||
// globalRole (profiles.role) não mapeia para menus reais → precisamos da tenant role.
|
||||
const _menuStore = useMenuStore()
|
||||
if (!_menuStore.ready) {
|
||||
try {
|
||||
const _tStore = useTenantStore()
|
||||
if (!_tStore.activeRole) {
|
||||
await _tStore.loadSessionAndTenant()
|
||||
}
|
||||
const _role = _tStore.activeRole
|
||||
const _tid = _tStore.activeTenantId || null
|
||||
if (_role && _tid) {
|
||||
// Carrega entitlements do tenant (mesma lógica do guard principal)
|
||||
const _ent = useEntitlementsStore()
|
||||
if (shouldLoadEntitlements(_ent, _tid)) {
|
||||
await loadEntitlementsSafe(_ent, _tid, true)
|
||||
}
|
||||
// Entitlements pessoais (therapist/supervisor têm assinatura própria)
|
||||
const _roleNorm = normalizeRole(_role)
|
||||
if (['therapist', 'supervisor'].includes(_roleNorm) && _ent.loadedForUser !== uid) {
|
||||
try { await _ent.loadForUser(uid) } catch {}
|
||||
}
|
||||
await ensureMenuBuilt({ uid, tenantId: _tid, tenantRole: _role, globalRole })
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
_perfEnd()
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user