feat: add authentication support and user model
- Updated `env.example` to include NextAuth configuration for authentication. - Added `next-auth` dependency to manage user sessions. - Introduced `User` model in Prisma schema with fields for user details and password hashing. - Integrated `AuthProvider` in layout for session management across the app. - Enhanced `Header` component with `AuthButton` for user authentication controls.
This commit is contained in:
31
src/types/next-auth.d.ts
vendored
Normal file
31
src/types/next-auth.d.ts
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
import NextAuth from "next-auth"
|
||||
|
||||
declare module "next-auth" {
|
||||
interface Session {
|
||||
user: {
|
||||
id: string
|
||||
email: string
|
||||
name: string
|
||||
firstName?: string
|
||||
lastName?: string
|
||||
avatar?: string
|
||||
role: string
|
||||
}
|
||||
}
|
||||
|
||||
interface User {
|
||||
id: string
|
||||
email: string
|
||||
name: string
|
||||
firstName?: string
|
||||
lastName?: string
|
||||
avatar?: string
|
||||
role: string
|
||||
}
|
||||
}
|
||||
|
||||
declare module "next-auth/jwt" {
|
||||
interface JWT {
|
||||
id: string
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user