feat: connexionButton
This commit is contained in:
@@ -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 };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user