Tenantdaten vollständig laden
Lädt den aktiven Tenant über die Tenant-Route nach und gibt calendarConfig in der Me-Antwort mit zurück.
This commit is contained in:
@@ -355,8 +355,24 @@ export const useAuthStore = defineStore("auth", {
|
||||
if(this.profile?.temp_config) tempStore.setStoredTempConfig(this.profile.temp_config)
|
||||
|
||||
if(me.activeTenant > 0) {
|
||||
this.activeTenant = me.activeTenant
|
||||
this.activeTenantData = me.tenants.find(i => i.id === me.activeTenant)
|
||||
const normalizedActiveTenant = String(me.activeTenant)
|
||||
this.activeTenant = normalizedActiveTenant
|
||||
this.activeTenantData = me.tenants.find(i => String(i.id) === normalizedActiveTenant) || null
|
||||
|
||||
try {
|
||||
const tenant = await useNuxtApp().$api("/api/tenant", {
|
||||
headers: {
|
||||
Authorization: `Bearer ${tokenToUse}`,
|
||||
context: { jwt: tokenToUse }
|
||||
}
|
||||
})
|
||||
|
||||
if (tenant?.id) {
|
||||
this.activeTenantData = tenant
|
||||
}
|
||||
} catch (tenantError) {
|
||||
console.error("fetch active tenant failed", tenantError)
|
||||
}
|
||||
}
|
||||
|
||||
this.scheduleSessionTimers(tokenToUse)
|
||||
|
||||
@@ -77,6 +77,16 @@ export const useProfileStore = defineStore("profile", () => {
|
||||
|
||||
async function fetchOwnTenant() {
|
||||
syncFromAuth()
|
||||
try {
|
||||
const tenant = await useNuxtApp().$api("/api/tenant")
|
||||
if (tenant) {
|
||||
ownTenant.value = tenant
|
||||
auth.activeTenantData = tenant
|
||||
return
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
ownTenant.value = auth.activeTenantData || ownTenant.value
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user