fix: email update bug (#10306)

Co-authored-by: Keith Williams <[email protected]>
This commit is contained in:
Udit TakkarandKeith Williams authored and GitHub committed 2023-07-27 10:41:33 +02:00
1 parent cdb78b686b
commit 4f488be654
5 files changed
+24 -4

No files matched your search

@@ -350,6 +350,14 @@ export const AUTH_OPTIONS: AuthOptions = {
providers,
callbacks: {
async jwt({ token, user, account, trigger, session }) {
if (trigger === "update") {
return {
...token,
name: session?.name ?? token.name,
username: session?.username ?? token.username,
email: session?.email ?? token.email,
};
}
const autoMergeIdentities = async () => {
const existingUser = await prisma.user.findFirst({
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion