32 lines
885 B
TypeScript
32 lines
885 B
TypeScript
import { cookies } from "next/headers"
|
|
import { AppSidebar } from "./sidebar"
|
|
import {
|
|
SidebarInset,
|
|
SidebarProvider,
|
|
} from "@/components/ui/sidebar"
|
|
import { redirect } from "next/navigation"
|
|
import { Navigation } from "../nav"
|
|
import { Command } from "lucide-react"
|
|
import FooterSection from "@/components/footer"
|
|
|
|
export default async function Layout({ children }: { children: React.ReactNode }) {
|
|
|
|
const isLoggedIn = (await cookies()).get('jwt')?.value
|
|
|
|
console.log(isLoggedIn)
|
|
|
|
if (!isLoggedIn) {
|
|
redirect('/login')
|
|
}
|
|
|
|
return (
|
|
<div className="flex flex-col">
|
|
<div className="sticky top-0 z-50 bg-background flex flex-row items-center px-4">
|
|
<Command size={24} className="mr-4" />
|
|
<Navigation />
|
|
</div>
|
|
{children}
|
|
<FooterSection />
|
|
</div>
|
|
)
|
|
} |