From 6682cdcf561948321a0bfd47dde22e500631a26a Mon Sep 17 00:00:00 2001 From: Julien Froidefond Date: Wed, 12 Feb 2025 08:16:59 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20ajout=20du=20bouton=20de=20d=C3=A9conne?= =?UTF-8?q?xion=20dans=20la=20sidebar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/layout/Sidebar.tsx | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/components/layout/Sidebar.tsx b/src/components/layout/Sidebar.tsx index 0e8addf..abc791b 100644 --- a/src/components/layout/Sidebar.tsx +++ b/src/components/layout/Sidebar.tsx @@ -1,7 +1,8 @@ -import { BookOpen, Home, Library, Settings } from "lucide-react"; +import { BookOpen, Home, Library, Settings, LogOut } from "lucide-react"; import Link from "next/link"; -import { usePathname } from "next/navigation"; +import { usePathname, useRouter } from "next/navigation"; import { cn } from "@/lib/utils"; +import { authService } from "@/lib/services/auth.service"; interface SidebarProps { isOpen: boolean; @@ -9,6 +10,12 @@ interface SidebarProps { export function Sidebar({ isOpen }: SidebarProps) { const pathname = usePathname(); + const router = useRouter(); + + const handleLogout = () => { + authService.logout(); + router.push("/login"); + }; const navigation = [ { @@ -26,11 +33,11 @@ export function Sidebar({ isOpen }: SidebarProps) { return ( ); }