I am able to get the API Response Time (duration) in the 'makeAPICall' function. Now I need to pass it(the value of the duration variable)to another async function. I am wondering if you could please provide the solution?
const makeApiCall = ClientFunction(() => {
console.time("timer1");
const testLocation = () => fetch('https://xxxxxx',
{method : 'GET',
headers:{
hash: 'xxxxx',
id: 'xxxxxxxxc'
}
})
.then(response => response.json())
.then(data => {
let duration = console.timeEnd("timer1");
console.log(duration);
});
return testLocation();
});
test('test', async t => {
await makeApiCall();
console.log(duration)?????
});