DEV Community

Discussion on: Angular and the REST, Nest.js and JWT

Collapse
 
ghiscoding profile image
Ghislain B.

Thanks for the article, a small correction to the code in the Controller, you forgot to await the login result. It shoulb be return await this.authService.login(req.user);

Collapse
 
jesusz0r profile image
Jesus Mendoza • Edited

Hey Ghislain. Nestjs handles

async login(@Request() req) {
return this.authService.login(req.user);
}

As a promise, so, Is redundant to return await this.authService.login(req.user); since internally Nestjs will await the login function anyway, so if you return another async function from it, it will be internally awaited