Skip to content

Commit

Permalink
Extend the session when there's a valid interaction.
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunoBernardino committed Apr 14, 2023
1 parent 001bedc commit 39f12e2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/data-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,10 @@ export async function validateUserAndSession(userId: string, sessionId: string,
throw new Error('Not Found');
}

const oneMonthFromToday = new Date(new Date().setUTCMonth(new Date().getUTCMonth() + 1));

session.last_seen_at = new Date();
session.expires_at = oneMonthFromToday;

await updateSession(session);

Expand Down

0 comments on commit 39f12e2

Please sign in to comment.