Skip to content

Commit

Permalink
fix: 馃悰 fix code
Browse files Browse the repository at this point in the history
  • Loading branch information
yeukfei02 committed Apr 21, 2022
1 parent 9c6616f commit 204a334
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
6 changes: 5 additions & 1 deletion src/login/login.controller.ts
Expand Up @@ -17,7 +17,11 @@ export class LoginController {
type: LoginResponse,
})
async login(@Body() loginDto: LoginDto): Promise<any> {
let response = {};
let response = {
message: 'login',
users: {},
token: '',
};

const users = await this.loginService.login(loginDto);
if (users) {
Expand Down
17 changes: 9 additions & 8 deletions src/login/login.service.ts
Expand Up @@ -16,14 +16,15 @@ export class LoginService {
email: loginDto.email,
},
});

const isValidPassword = bcrypt.compareSync(
loginDto.password,
users.password,
);
console.log('isValidPassword = ', isValidPassword);
if (isValidPassword) {
result = users;
if (users) {
const isValidPassword = bcrypt.compareSync(
loginDto.password,
users.password,
);
console.log('isValidPassword = ', isValidPassword);
if (isValidPassword) {
result = users;
}
}

return result;
Expand Down

0 comments on commit 204a334

Please sign in to comment.