troubleshooting login/logout

This commit is contained in:
Mikayla Dobson
2022-11-21 17:24:44 -06:00
parent 28c84efcd5
commit 5ddd01a537
15 changed files with 205 additions and 56 deletions

View File

@@ -39,8 +39,25 @@ export default class AuthService {
}
async login(data: IUserAuth): Promise<Array<keyof IUser>> {
return [];
async login(data: IUserAuth) {
const { email, password } = data;
try {
const user = await UserInstance.getOneByEmail(email);
if (!user) return { ok: false, user: null }
const match = await bcrypt.compare(password, user.password);
console.log(match);
return {
ok: match,
user: match ? user : null
}
} catch (e: any) {
throw new Error(e);
}
}
async logout() {
}
// methods for Google OAuth