diff --git a/apps/backoffice/app/(app)/layout.tsx b/apps/backoffice/app/(app)/layout.tsx index 7079910..3647508 100644 --- a/apps/backoffice/app/(app)/layout.tsx +++ b/apps/backoffice/app/(app)/layout.tsx @@ -93,7 +93,9 @@ export default async function AppLayout({ children }: { children: ReactNode }) { - +
+ +
Promise; }) { const { t } = useTranslation(); + const router = useRouter(); const [isOpen, setIsOpen] = useState(false); const [mounted, setMounted] = useState(false); const [, startTransition] = useTransition(); + async function handleLogout() { + await fetch("/api/auth/logout", { method: "POST" }); + router.push("/login"); + router.refresh(); + } + function select(userId: string | null) { startTransition(async () => { const fd = new FormData(); @@ -128,6 +136,17 @@ export function MobileNav({ navItems, users, activeUserId, setActiveUserAction } {t("nav.settings")} + diff --git a/apps/backoffice/lib/i18n/en.ts b/apps/backoffice/lib/i18n/en.ts index 414ea32..40d03a4 100644 --- a/apps/backoffice/lib/i18n/en.ts +++ b/apps/backoffice/lib/i18n/en.ts @@ -1,6 +1,9 @@ import type { TranslationKey } from "./fr"; const en: Record = { + // Auth + "auth.logout": "Log out", + // Navigation "nav.dashboard": "Dashboard", "nav.books": "Books", diff --git a/apps/backoffice/lib/i18n/fr.ts b/apps/backoffice/lib/i18n/fr.ts index f455473..08f1c6b 100644 --- a/apps/backoffice/lib/i18n/fr.ts +++ b/apps/backoffice/lib/i18n/fr.ts @@ -1,4 +1,7 @@ const fr = { + // Auth + "auth.logout": "Se déconnecter", + // Navigation "nav.dashboard": "Tableau de bord", "nav.books": "Livres",