Created
November 21, 2018 19:37
-
-
Save camilomontoyau/ee07cf20964215d3b8bbba77ed0c7ae7 to your computer and use it in GitHub Desktop.
async await
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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