Authentication with Credentials is working and setup, same for OAuth with Google.

This commit is contained in:
charles-gauthereau
2024-11-09 21:38:18 +01:00
parent 6541cfcc26
commit 6d90bb23c1
24 changed files with 784 additions and 341 deletions
-4
View File
@@ -3,20 +3,16 @@ import {User} from "@prisma/client";
export const currentUser = async () => {
const session = await baseAuth();
if (!session?.user) {
return null;
}
return session.user as User;
}
export const requiredCurrentUser = async () => {
const user = await currentUser();
if (!user) {
throw new Error("User not found");
}
return user;
}