2
0

fix(auth): 🐛 Production bug

This commit is contained in:
Baptiste Arnaud
2022-01-06 10:17:24 +01:00
parent 77b553acf5
commit eea522f5bd

View File

@@ -84,12 +84,13 @@ const createOptions = (req: NextApiRequest): NextAuthOptions => ({
} else if (user) { } else if (user) {
token.user = user token.user = user
} }
account?.type && (token.providerType = account?.type) account?.type && token && (token.providerType = account?.type)
return token return token
}, },
session: async ({ session, token, user }) => { session: async ({ session, token, user }) => {
token?.user ? (session.user = token.user as User) : (session.user = user) token?.user ? (session.user = token.user as User) : (session.user = user)
return { ...session, providerType: token.providerType } if (token?.providerType) session.providerType = token.providerType
return session
}, },
}, },
}) })