clean-branch-56468
06/01/2023, 11:21 PMworkflow.team
is always empty. Bu the second time I run the Bot, the request runs successfully and the array is populated. Any Ideas what Im doing wrong? Thanks
const getOptions = {
method: 'GET',
url: `https://app.asana.com/api/1.0/teams/${env.ASANA_MARKETING_GID}/team_memberships`,
headers: {
accept: 'application/json',
authorization: `${env.ASANA_BARER_TOKEN}`
}
};
axios.request(getOptions)
.then((response) => {
let team = [];
if (response.status === 200) {
const users = response.data.data;
for (let i = 0, len = users.length; i < len; i++) {
team.push(users[i].user);
}
console.log("team length", team.length)
workflow.team = team
}
}).catch((error) => {
console.error(error);
});
acceptable-kangaroo-64719
06/02/2023, 10:30 AMawait
?clean-branch-56468
06/02/2023, 10:36 AMacceptable-kangaroo-64719
06/02/2023, 10:37 AM