Read operation on operation id got from azure read api

Chetan Bawankule 1 Reputation point
2021-04-20T15:11:30.877+00:00

I am trying to read the data in operation id url but for that I have to use settimeout function and set some time , if I use it without settimeout it alway's shows status is runing .

const read_result = (opid) => {
var dlres;
var config = {
method: 'get',
url: opid,
parameters:{
operationId:opid
},
headers: {
'Ocp-Apim-Subscription-Key': 'my key'
},
};
axios(config)
.then(function (response) {
console.log("\n");
console.log("\n");
console.log(response.status);
// console.log(response.data.analyzeResult.readResults[0].lines[1].text);
dlres = response.data;
})
.catch(function (error) {
console.log("there is error ", error);
});

return dlres;

}

this is my code, I want to know how to make it wait till the response status become "succeed" and then return.

Azure Computer Vision
Azure Computer Vision
An Azure artificial intelligence service that analyzes content in images and video.
381 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.