Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
chibat committed Nov 25, 2023
1 parent 8abb271 commit fc54b22
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions server/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ export async function getSession(req: Request) {

export async function createSession(response: Response, userId: number) {
const sessionId = await insertSession(userId);
const expires = new Date();
expires.setMonth(expires.getMonth() + 1);
setCookie(response.headers, {
name: "session",
value: sessionId,
expires,
sameSite: "Lax",
httpOnly: true,
secure: true,
Expand Down
4 changes: 3 additions & 1 deletion server/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,8 @@ function deleteExpiredSession(userId: number) {
"updated_at",
date.toISOString(),
).then(({ error }) => {
console.error(error);
if (error) {
console.error(error);
}
});
}

0 comments on commit fc54b22

Please sign in to comment.