mirror of
https://litchi.icu/ngc2207/judge.git
synced 2025-05-18 16:17:21 +00:00
feat(auth): integrate Prisma adapter for Auth.js authentication
This commit is contained in:
parent
ee3c6eea47
commit
61f0818f0d
11
package.json
11
package.json
@ -9,6 +9,8 @@
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@auth/prisma-adapter": "^2.7.4",
|
||||
"@prisma/client": "^6.1.0",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"lucide-react": "^0.469.0",
|
||||
@ -20,13 +22,14 @@
|
||||
"tailwindcss-animate": "^1.0.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5",
|
||||
"@types/node": "^20",
|
||||
"@types/react": "^18",
|
||||
"@types/react-dom": "^18",
|
||||
"postcss": "^8",
|
||||
"tailwindcss": "^3.4.1",
|
||||
"eslint": "^8",
|
||||
"eslint-config-next": "15.0.3"
|
||||
"eslint-config-next": "15.0.3",
|
||||
"postcss": "^8",
|
||||
"prisma": "^6.1.0",
|
||||
"tailwindcss": "^3.4.1",
|
||||
"typescript": "^5"
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
import NextAuth from "next-auth";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import { PrismaAdapter } from "@auth/prisma-adapter";
|
||||
|
||||
export const { handlers, signIn, signOut, auth } = NextAuth({
|
||||
adapter: PrismaAdapter(prisma),
|
||||
providers: [],
|
||||
});
|
||||
|
7
src/lib/prisma.ts
Normal file
7
src/lib/prisma.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
|
||||
const globalForPrisma = globalThis as unknown as { prisma: PrismaClient };
|
||||
|
||||
export const prisma = globalForPrisma.prisma || new PrismaClient();
|
||||
|
||||
if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;
|
Loading…
Reference in New Issue
Block a user