Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One Then Might Be Better #43

Open
yosefanajjar opened this issue Aug 29, 2019 · 1 comment
Open

One Then Might Be Better #43

yosefanajjar opened this issue Aug 29, 2019 · 1 comment

Comments

@yosefanajjar
Copy link
Member

getUser(value).then((user) => user.rows[0])
.then((user) => {
res.cookie('id', user.id);
res.render('home', { name: user.user_name });

Instead of having two then's you could've used object destructuring and made it look readable 😄

getUser(value).
                .then(({ rows }) => {
                  res.cookie('id', rows[0].id);
                  res.render('home', { name: rows[0].user_name });
                })
@Asmaathabet
Copy link
Member

ok in the next time 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants