Skip to content

Commit

Permalink
🐛 Fix session update (#1601)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukevella authored Mar 3, 2025
1 parent 83bf083 commit b6fc95b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/web/src/next-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ const {

return true;
},
async jwt({ token, session, trigger }) {
if (trigger === "update") {
async jwt({ token, session }) {
if (session) {
const parsed = sessionUpdateSchema.safeParse(session);
if (parsed.success) {
Object.entries(parsed.data).forEach(([key, value]) => {
Expand All @@ -163,12 +163,14 @@ const {
timeFormat: true,
timeZone: true,
weekStart: true,
image: true,
},
});

if (user) {
token.name = user.name;
token.email = user.email;
token.picture = user.image;
token.locale = user.locale;
token.timeFormat = user.timeFormat;
token.timeZone = user.timeZone;
Expand Down

0 comments on commit b6fc95b

Please sign in to comment.