fixfixfix

This commit is contained in:
Omer Sabic 2024-06-07 15:27:28 +02:00
parent fba83c3943
commit 3871396339

View File

@ -29,6 +29,7 @@ export const authRoutes = (fastify, _, done) => {
const [existing_user] = await db.select().from(usersTable).where(eq(usersTable.google_id, user_info.id)); const [existing_user] = await db.select().from(usersTable).where(eq(usersTable.google_id, user_info.id));
let user; let user;
let session_id;
await db.transaction(async tx => { await db.transaction(async tx => {
try { try {
if (existing_user) { if (existing_user) {
@ -62,7 +63,6 @@ export const authRoutes = (fastify, _, done) => {
return; return;
} }
} }
let session_id;
let existing_session = await tx.select().from(sessions).where(eq(sessions.user_id, user.id)); let existing_session = await tx.select().from(sessions).where(eq(sessions.user_id, user.id));
if (!existing_session || existing_session.length === 0) { if (!existing_session || existing_session.length === 0) {
let session_info = await createSession(user.id, { let session_info = await createSession(user.id, {