Replace composable with Pinia store for persistent auth state

This commit is contained in:
Torsten Schulz (local)
2025-10-21 14:19:30 +02:00
parent 1015d37eb7
commit 43071b45a9
10 changed files with 137 additions and 69 deletions

View File

@@ -396,13 +396,15 @@ import { useRoute } from 'vue-router'
import { Menu, X, ChevronDown } from 'lucide-vue-next'
const route = useRoute()
const authStore = useAuthStore()
const isMobileMenuOpen = ref(false)
const mobileSubmenu = ref(null)
const mannschaften = ref([])
const hasGalleryImages = ref(false)
// Use global auth state
const { isLoggedIn, userRole, isAdmin, checkAuth } = useAuth()
// Reactive auth state from store
const isLoggedIn = computed(() => authStore.isLoggedIn)
const isAdmin = computed(() => authStore.isAdmin)
// Automatisches Setzen des Submenus basierend auf der Route
const currentSubmenu = computed(() => {
@@ -486,7 +488,7 @@ const checkGalleryImages = async () => {
onMounted(() => {
loadMannschaften()
checkGalleryImages()
checkAuth()
authStore.checkAuth()
})
const toggleSubmenu = (menu) => {