Skip to content

Commit

Permalink
Merge pull request #2 from lts20050703/lts20050703-patch-1
Browse files Browse the repository at this point in the history
Fix SQLite guide code errors
  • Loading branch information
pilcrowonpaper authored Oct 14, 2024
2 parents be23924 + abbc586 commit bf9ffc0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pages/sessions/basic-api/sqlite.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export function createSession(token: string, userId: number): Session {
"INSERT INTO session (id, user_id, expires_at) VALUES (?, ?, ?)",
session.id,
session.userId,
Math.floor(session.expiresAt / 1000)
Math.floor(session.expiresAt.getTime() / 1000)
);
return session;
}
Expand Down Expand Up @@ -161,7 +161,7 @@ export function validateSessionToken(token: string): SessionValidationResult {
session.expiresAt = new Date(Date.now() + 1000 * 60 * 60 * 24 * 30);
db.execute(
"UPDATE session SET expires_at = ? WHERE id = ?",
Math.floor(session.expiresAt / 1000),
Math.floor(session.expiresAt.getTime() / 1000),
session.id
);
}
Expand Down Expand Up @@ -206,7 +206,7 @@ export function createSession(token: string, userId: number): Session {
"INSERT INTO session (id, user_id, expires_at) VALUES (?, ?, ?)",
session.id,
session.userId,
Math.floor(session.expiresAt / 1000)
Math.floor(session.expiresAt.getTime() / 1000)
);
return session;
}
Expand Down Expand Up @@ -236,7 +236,7 @@ export function validateSessionToken(token: string): SessionValidationResult {
session.expiresAt = new Date(Date.now() + 1000 * 60 * 60 * 24 * 30);
db.execute(
"UPDATE session SET expires_at = ? WHERE id = ?",
Math.floor(session.expiresAt / 1000),
Math.floor(session.expiresAt.getTime() / 1000),
session.id
);
}
Expand Down

0 comments on commit bf9ffc0

Please sign in to comment.