Sorry for my bad English. But i'm stuggling with an problem and I hope someone can help me out.
const FinalResult = [];
const users = [
{
short: "gurdt",
gameTag: "gurdt#3199278"
},
{
short: "lc",
gameTag: "LC_92#4607792"
},
{
short: "ray",
gameTag: "The_Green_Ray"
},
{
short: "leon",
gameTag: "Theaxeman777#7613572"
}
];
async function getData(user) {
const config = {
method: "get",
url: `https://my.callofduty.com/api/papi-client/stats/cod/v1/title/mw/platform/uno/gamer/${encodeURIComponent(
user
)}/profile/type/wz`,
headers: {
Cookie:
"TOKEN-1234"
}
};
const rawResponse = await axios(config);
const result = {
user: user,
...rawResponse.data.data.weekly.all.properties
};
return result;
}
users.map((user) => {
const data = getData(user.gameTag);
FinalResult.push(data);
return false;
});
console.log(FinalResult);
What I want is that he loops over the users and make here one big array of all the results FinalResult.
Hope that you know what I mean, otherwise tomorrow I will update this question as I'm on my computer and put more info..