diff --git a/wp-content/themes/moonshine/app/components/site/SiteFooterBottom.vue b/wp-content/themes/moonshine/app/components/site/SiteFooterBottom.vue index 1fe3f7f..4a70abb 100644 --- a/wp-content/themes/moonshine/app/components/site/SiteFooterBottom.vue +++ b/wp-content/themes/moonshine/app/components/site/SiteFooterBottom.vue @@ -1,8 +1,12 @@ + + - diff --git a/wp-content/themes/moonshine/app/composables/useAuth.ts b/wp-content/themes/moonshine/app/composables/useAuth.ts index 55667fb..aed5532 100644 --- a/wp-content/themes/moonshine/app/composables/useAuth.ts +++ b/wp-content/themes/moonshine/app/composables/useAuth.ts @@ -2,5 +2,6 @@ export function useAuth() { const { loggedIn: isLoggedIn, session } = useUserSession(); const hasRole = (role: string) => session.value?.user?.roles?.includes(role) || false; const isAdmin = computed(() => hasRole("administrator")); + return { isLoggedIn, hasRole, isAdmin }; } diff --git a/wp-content/themes/moonshine/app/composables/useAuthConnexion.ts b/wp-content/themes/moonshine/app/composables/useAuthConnexion.ts index 2f670d3..7a64a51 100644 --- a/wp-content/themes/moonshine/app/composables/useAuthConnexion.ts +++ b/wp-content/themes/moonshine/app/composables/useAuthConnexion.ts @@ -3,6 +3,7 @@ import type { FormSubmitEvent } from "@nuxt/ui"; const isRedirecting = ref(false); export function useAuthConnexion() { + const { isLoggedIn } = useAuth(); const toast = useToast(); const { fetch: refreshUserSession } = useUserSession(); const routeRedirect = useRoute().query.redirect as string || undefined; @@ -67,5 +68,12 @@ export function useAuthConnexion() { } } - return { isRedirecting, login, logout }; + // Dynamic connexion link + const connexionButton = computed(() => ({ + label: isLoggedIn.value ? "Déconnexion" : "Connexion", + icon: isLoggedIn.value ? "i-lucide-log-out" : "i-lucide-log-in", + to: "/connexion", + })); + + return { isRedirecting, login, logout, connexionButton }; }