debug
This commit is contained in:
parent
54ed89cdd8
commit
096b4f64d4
@ -14,9 +14,11 @@ export async function createSession(user_id, {
|
||||
refresh_token,
|
||||
expires_at,
|
||||
}) {
|
||||
try {
|
||||
|
||||
const [existing_session] = await db.select().from(sessions).where(eq(sessions.user_id, user_id));
|
||||
|
||||
if(existing_session) {
|
||||
if (existing_session) {
|
||||
return {
|
||||
session_id: existing_session.id
|
||||
}
|
||||
@ -28,11 +30,16 @@ export async function createSession(user_id, {
|
||||
refresh_token: refresh_token,
|
||||
expires_at
|
||||
}).returning({ id: sessions.id });
|
||||
if(token.length == 0) {
|
||||
if (token.length == 0) {
|
||||
throw new Error("Error creating auth token");
|
||||
}
|
||||
|
||||
return {
|
||||
session_id: token[0].id
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user