fix(auth): defer dashboard loading until tenant selection

This commit is contained in:
2026-09-23 18:21:40 +02:00
parent 96295ee4f0
commit 60553bbba8
4 changed files with 747 additions and 593 deletions

View File

@@ -280,7 +280,6 @@ export const useAuthStore = defineStore("auth", {
body: { email, password, rememberMe }
})
console.log("Token: " + token)
// Tokens abhängig von „Angemeldet bleiben“ dauerhaft oder nur für diese Sitzung speichern
this.setSession(token, refreshToken, rememberMe)
@@ -289,7 +288,6 @@ export const useAuthStore = defineStore("auth", {
// 2. User Daten laden
await this.fetchMe(token)
console.log(this.user)
// 3. WICHTIG: Jetzt explizit weiterleiten!
// Prüfen, ob der User geladen wurde
@@ -380,7 +378,6 @@ export const useAuthStore = defineStore("auth", {
})
// ... (Deine Logik für tenants, sorting etc. bleibt gleich) ...
console.log(me)
this.user = me.user
this.permissions = me.permissions
this.tenants = me.tenants
@@ -394,6 +391,9 @@ export const useAuthStore = defineStore("auth", {
if(this.profile?.temp_config) tempStore.setStoredTempConfig(this.profile.temp_config)
this.activeTenant = null
this.activeTenantData = null
if(me.activeTenant > 0) {
const normalizedActiveTenant = String(me.activeTenant)
this.activeTenant = normalizedActiveTenant
@@ -417,7 +417,6 @@ export const useAuthStore = defineStore("auth", {
this.scheduleSessionTimers(tokenToUse)
console.log(this)
} catch (err: any) {
// WICHTIG: Hier NICHT this.logout() aufrufen, weil das navigiert!
@@ -477,7 +476,6 @@ export const useAuthStore = defineStore("auth", {
refreshToken: this.getStoredRefreshToken()
}
})
console.log(res)
const {token, refreshToken} = res
this.setSession(token, refreshToken, this.sessionPersistent)