arrays - Nativescript multiple fetch http post -
i'm facing little problem. how should make looping post (arrays of data) need send 1 one waiting earlier post response before sending one. ideas welcome!
i'm using newest nativescript , stock fetch module.
sounds recursive call me, like:
function postdata(arr, index){ let itemtopost = arr[index]; fetch('https://xyz/some/url', { method: 'post' content: json.stringify(itemtopost)// }).then(function(response) { //success //recursive call here postdata(arr, ++index) }).catch(function(err) { // error :( }); }
Comments
Post a Comment