@@ -12,6 +12,7 @@ import {
1212import { Button } from '@/components/ui/button'
1313import { IsLoggedIn } from '@/lib/firebase/firebase'
1414import Landing from '@/components/landing'
15+ import { cookies } from 'next/headers'
1516
1617const menuItems = [
1718 { title : 'Dashboard' , icon : ChartSpline , href : '/dashboard' , level : 3 } ,
@@ -42,6 +43,13 @@ const menuItems = [
4243 // { title: 'My Borrows', icon: BookCopy, href: '/borrows/me', level: 2 },
4344]
4445
46+ async function logoutAction ( ) {
47+ 'use server'
48+ const cookieStore = await cookies ( )
49+ const sessionName = process . env . SESSION_COOKIE_NAME as string
50+ cookieStore . delete ( sessionName )
51+ }
52+
4553export default async function LibraryDashboard ( ) {
4654 const claim = await IsLoggedIn ( )
4755
@@ -62,8 +70,13 @@ export default async function LibraryDashboard() {
6270
6371 return (
6472 < main className = "min-h-screen p-8" >
65- < div className = "max-w-2xl mx-auto" >
66- < h1 className = "text-2xl font-bold mb-8" > Librarease</ h1 >
73+ < div className = "max-w-2xl mx-auto space-y-4" >
74+ < div className = "flex justify-between items-center" >
75+ < h1 className = "text-2xl font-bold" > Librarease</ h1 >
76+ < Button variant = "ghost" onClick = { logoutAction } >
77+ Logout
78+ </ Button >
79+ </ div >
6780 < div className = "grid gap-4 md:grid-cols-2 lg:grid-cols-3" >
6881 { menuItems . map ( ( item ) => {
6982 if ( item . level > userLvl ) return null
0 commit comments