Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
feat: add all user data to next-auth session
Marc Seitzdd19ffd2cdb6
diff --git a/lib/types.ts b/lib/types.tsindex 95210305..2b9a9af4 100644--- a/lib/types.ts+++ b/lib/types.ts@@ -1,10 +1,7 @@import { User as NextAuthUser } from "next-auth";-import { Document, Link, View } from "@prisma/client";+import { Document, Link, View, User as PrismaUser } from "@prisma/client";-export interface CustomUser extends NextAuthUser {- id: string;- createdAt: Date;-}+export type CustomUser = NextAuthUser & PrismaUser;export interface CreateUserEmailProps {user: {diff --git a/pages/api/auth/[...nextauth].ts b/pages/api/auth/[...nextauth].tsindex 3607e808..74648964 100644--- a/pages/api/auth/[...nextauth].ts+++ b/pages/api/auth/[...nextauth].ts@@ -42,9 +42,9 @@ export const authOptions: NextAuthOptions = {},session: async ({ session, token }) => {(session.user as CustomUser) = {- // @ts-ignoreid: token.sub,- ...session.user,+ // @ts-ignore+ ...(token || session).user,};return session;},