Add global auth state with composable for reactive login status
This commit is contained in:
@@ -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') {
|
||||
|
||||
Reference in New Issue
Block a user