Skip to content

Commit

Permalink
chore: sign in sync updated at value (#1095)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxkaske authored Nov 9, 2024
1 parent d2a4cf0 commit 4e4e0ac
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions apps/web/src/lib/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const { handlers, signIn, signOut, auth } = NextAuth({
photoUrl: params.profile.picture,
// keep the name in sync
name: `${params.profile.given_name} ${params.profile.family_name}`,
updatedAt: new Date(),
})
.where(eq(user.id, Number(params.user.id)))
.run();
Expand All @@ -49,11 +50,21 @@ export const { handlers, signIn, signOut, auth } = NextAuth({
.set({
name: params.profile.name,
photoUrl: String(params.profile.avatar_url),
updatedAt: new Date(),
})
.where(eq(user.id, Number(params.user.id)))
.run();
}

// REMINDER: only used in dev mode
if (params.account?.provider === "resend") {
await db
.update(user)
.set({ updatedAt: new Date() })
.where(eq(user.id, Number(params.user.id)))
.run();
}

return true;
},
async session(params) {
Expand Down

0 comments on commit 4e4e0ac

Please sign in to comment.