Im using Facebook API, trying to create a custom
async function createAudience(data) {
try {
console.log(` Upload: ${JSON.stringify(data)}`);
return await axios.post(`https://example.com/{account_id}/audience`, data);
} catch (error) {
console.error(error);
}
}
And it works just fine, but I need to access the response.status outside the function, and im lost...
const ca_response = await createAudience(audienceData)
.then((result) => {
return result.status })
.catch(err => console.error(err));
I can push it and it works, I can acces ((result) => { return result.status }) from the function without an issue, but can't work with it from ouside... How can i create the const audienceStatus to be used on the rest of my code?? Thanks!
question from:
https://stackoverflow.com/questions/65945702/access-json-response-status-outside-the-function-axios 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…