add check for non-existant user

main
Cogent Apps 2023-03-18 00:03:26 +00:00
parent 0be9133cdc
commit 00ad70f5b8
1 changed files with 3 additions and 1 deletions

View File

@ -89,9 +89,11 @@ export class SQLiteAdapter extends Database {
public async getUser(email: string): Promise<any> { public async getUser(email: string): Promise<any> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
db.get(`SELECT * FROM authentication WHERE email = ?`, [email], (err: any, row: any) => { db.get(`SELECT * FROM authentication WHERE email = ?`, [email], (err: any, row: any) => {
if (err || !row) { if (err) {
reject(err); reject(err);
console.log(`[database:sqlite] failed to get user ${email}`); console.log(`[database:sqlite] failed to get user ${email}`);
} else if (!row) {
resolve(null);
} else { } else {
resolve({ resolve({
...row, ...row,