From f00ce42f7430bc950bdefc8fc5cba8293747c2bf Mon Sep 17 00:00:00 2001 From: Bastian Masanek Date: Fri, 21 Nov 2025 11:56:20 +0100 Subject: [PATCH] Handle 401 Error During Role Status Fetch in useActiveRole Composable --- app/composables/useActiveRole.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/composables/useActiveRole.ts b/app/composables/useActiveRole.ts index e26d2bf..d179871 100644 --- a/app/composables/useActiveRole.ts +++ b/app/composables/useActiveRole.ts @@ -56,6 +56,13 @@ export function useActiveRole() { return data } catch (err: any) { + // 401 during session initialization is normal - watch() will retry successfully + if (err.statusCode === 401) { + console.debug('Role status fetch: Session not ready yet, will retry via watch()') + return null + } + + // Other errors are real problems console.error('Failed to fetch role status:', err) error.value = 'Fehler beim Laden der Rollen' throw err