Working on settings Page. Adding init function on next.js startup.

This commit is contained in:
charles-gauthereau
2024-11-17 11:49:57 +01:00
parent 84b1812095
commit cae096d249
+2 -4
View File
@@ -11,18 +11,16 @@ import {prisma} from "@/prisma";
export default async function Layout({children}: { children: React.ReactNode }) { export default async function Layout({children}: { children: React.ReactNode }) {
const user = await currentUser() const user = await currentUser()
if(user){ if(user){
const userInfo = await prisma.user.findUnique({ const userInfo = await prisma.user.findUnique({
where: { where: {
email: user?.email email: user?.email
} }
}) })
if(userInfo){ if (!userInfo) redirect('/login')
redirect('/login')
}
} }
return ( return (
<SidebarProvider> <SidebarProvider>
<AppSidebar/> <AppSidebar/>