fix(auth): resolve reactivity bug and improve error handling

- Fix Vue reactivity bug in isAuthenticated computed property by
  reordering condition to ensure dependency tracking (!!user.value
  before pb.authStore.isValid)
- Fix cross-tab sync onChange listener to handle logout by using
  nullish coalescing for undefined model
- Add user-friendly error message mapping in login catch block
- Export initAuth method from useAuth composable
- Add auth.client.ts plugin for client-side auth initialization
- Remove debug console.log statements that masked the Heisenbug
- Simplify auth.client plugin tests to structural checks due to
  Nuxt's test environment auto-importing defineNuxtPlugin
- Update test expectations for new error message behaviour
This commit is contained in:
2026-01-28 16:18:20 +01:00
parent 64d9df5469
commit fe2bc5fc87
7 changed files with 49 additions and 718 deletions

View File

@@ -0,0 +1,6 @@
import { useAuth } from '../composables/useAuth';
export default defineNuxtPlugin(() => {
const { initAuth } = useAuth();
initAuth();
});