Add global auth state with composable for reactive login status

This commit is contained in:
Torsten Schulz (local)
2025-10-21 14:12:01 +02:00
parent 86f21537a8
commit 1015d37eb7
175 changed files with 1618 additions and 2157 deletions

View File

@@ -101,6 +101,7 @@ import { useRouter } from 'vue-router'
import { AlertCircle, Check, Loader2, Lock } from 'lucide-vue-next'
const router = useRouter()
const { checkAuth } = useAuth()
const formData = ref({
email: '',
@@ -128,6 +129,9 @@ const handleLogin = async () => {
if (response.success) {
successMessage.value = 'Anmeldung erfolgreich! Sie werden weitergeleitet...'
// Update global auth state
await checkAuth()
// Redirect based on role
setTimeout(() => {
if (response.user.role === 'admin' || response.user.role === 'vorstand') {