I have an array and i want to use promises on this array :
let check_duplicate_phone = store.state.lines.map(function (item) {
return core.checkIsPhoneDuplicate(item.phone , item.phone_significant);
});
let res = await Promise.all(check_duplicate_phone).then(function(values) {
console.log(values);
});
And this the checkIsPhoneDuplicate
function :
async checkIsPhoneDuplicate(phone , phone_significant) {
var data = {
'phone': phone ,
'phone_significant' : phone_significant
}
let res = await Axios.post(checkPhoneDuplicate_route, data)
.then(response => {
return response.data;
}).catch(error => console.log(error));
return res;
}
But its not waiting for the response and just run the next step. I know its supposed to used to like this and i already read this answer But i didn't findout where is my mistake.
thanks.