I am calling one API.in the then section of API call, i am calling another API. the output of first API will be passed to another API.
await axios
.post(process.env + '/certificates/upload', {
"name": "Shruti"
}
})
.then((response: any) => {
filenames = JSON.stringify(response.data.office);
axios // Not able to write async here
.patch(process.env + "/certificates/", {
file: filenames
})
.then(function(response: any) {
alert(' Record updated successfully');
})
.catch((err: any) => {
alert('Error in updating the record');
});
I am not able to use await
in second API call. Where should I put async
to use await
in second API call? first call is working properly. also Is there any better way to call consecutive API and Passing output of first call to second.