Skip to content

Instantly share code, notes, and snippets.

@camilomontoyau
Created November 21, 2018 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save camilomontoyau/ee07cf20964215d3b8bbba77ed0c7ae7 to your computer and use it in GitHub Desktop.
Save camilomontoyau/ee07cf20964215d3b8bbba77ed0c7ae7 to your computer and use it in GitHub Desktop.
async await
const getReview = async slug => {
try {
const userUid = await knex('user')
.where({
company_name: slug
})
.select('uid');
const userReviews = await axios.get(
`${url}/quotes/v1/reviews/?user=${user_uid}`,
{
headers: {
Authorization: `bearer ${token}`
}
}
);
for(let singleReview of userReviews.data) {
let project = await axios.get(
`/endpointproyects?${userReviews.data.projectid}`,
{
headers: {
Authorization: `bearer ${token}`
}
}
);
Userrevies[].project = project;
}
userUid.project = project;
const result = userUid;
return result;
} catch (error) {
console.log(error);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment