or without await, perhaps even nicer:
async function getPersonMinimal (_, profileId) {
// make a Promise (so we can return some thing)
return new Promise((resolve, reject) => {
// set a our query *ready* to be run
const runQuery = (done) => {
apollo.query(getPersonMinimal(profileId))
.then(res => {
if (res.errors) reject(res.errors) // graphql errors
else resolve(res.data.person)
})
.catch(err => reject(err)) // network errors
.finally(done)
}
queue.push(runQuery)
})
}