mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
Redirect if user does not exist.
This commit is contained in:
@@ -1,13 +1,18 @@
|
||||
import {LayoutAdmin} from "@/components/layout";
|
||||
import Image from 'next/image';
|
||||
import {currentUser, requiredCurrentUser} from "@/auth/current-user";
|
||||
import {currentUser} from "@/auth/current-user";
|
||||
import {redirect} from "next/navigation";
|
||||
import {prisma} from "@/prisma";
|
||||
|
||||
export default async function Layout({children}: { children: React.ReactNode }) {
|
||||
|
||||
const user = await currentUser()
|
||||
const userInfo = await prisma.user.findUnique({
|
||||
where: {
|
||||
email: user.email
|
||||
}
|
||||
})
|
||||
|
||||
if(user){
|
||||
if(userInfo){
|
||||
redirect('/dashboard')
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user