Skip to content

Commit

Permalink
fix updated expiresAt in validateSessionToken (#1728)
Browse files Browse the repository at this point in the history
Co-authored-by: pilcrowOnPaper <[email protected]>
  • Loading branch information
theAnuragMishra and pilcrowonpaper authored Oct 30, 2024
1 parent 6428975 commit e029847
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pages/sessions/basic-api/postgresql.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export async function validateSessionToken(token: string): Promise<SessionValida
const session: Session = {
id: row[0],
userId: row[1],
expiresAt: new Date(row[2] * 1000)
expiresAt: row[2]
};
const user: User = {
id: row[3]
Expand All @@ -161,7 +161,7 @@ export async function validateSessionToken(token: string): Promise<SessionValida
session.expiresAt = new Date(Date.now() + 1000 * 60 * 60 * 24 * 30);
await db.execute(
"UPDATE user_session SET expires_at = ? WHERE id = ?",
Math.floor(session.expiresAt / 1000),
session.expiresAt,
session.id
);
}
Expand Down Expand Up @@ -223,7 +223,7 @@ export async function validateSessionToken(token: string): Promise<SessionValida
const session: Session = {
id: row[0],
userId: row[1],
expiresAt: new Date(row[2] * 1000)
expiresAt: row[2]
};
const user: User = {
id: row[3]
Expand All @@ -236,7 +236,7 @@ export async function validateSessionToken(token: string): Promise<SessionValida
session.expiresAt = new Date(Date.now() + 1000 * 60 * 60 * 24 * 30);
await db.execute(
"UPDATE user_session SET expires_at = ? WHERE id = ?",
Math.floor(session.expiresAt / 1000),
session.expiresAt,
session.id
);
}
Expand Down

0 comments on commit e029847

Please sign in to comment.