2024-11-03 15:29:30 +01:00
|
|
|
import {SidebarInset, SidebarProvider, SidebarTrigger } from "@/components/ui/sidebar"
|
|
|
|
|
import {AppSidebar} from "@/components/wrappers/SideBar/app-sidebar";
|
2024-11-09 21:38:18 +01:00
|
|
|
import {currentUser} from "@/auth/current-user";
|
|
|
|
|
import {redirect} from "next/navigation";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default async function Layout({children}: { children: React.ReactNode }) {
|
|
|
|
|
|
|
|
|
|
const user = await currentUser()
|
|
|
|
|
|
|
|
|
|
if (!user) {
|
|
|
|
|
redirect('/login')
|
|
|
|
|
}
|
2024-11-03 15:29:30 +01:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<SidebarProvider>
|
|
|
|
|
<AppSidebar/>
|
|
|
|
|
<main>
|
|
|
|
|
<SidebarTrigger/>
|
|
|
|
|
{children}
|
|
|
|
|
</main>
|
|
|
|
|
</SidebarProvider>
|
|
|
|
|
)
|
|
|
|
|
}
|