After successfully obtaining the API Response Time (duration) using the 'makeAPICall' function, I am now faced with the task of passing this duration variable value to another asynchronous function. Can anyone assist me in finding a solution to achieve this?
const fetchAndMeasureDuration = ClientFunction(() => {
console.time("timer1");
const fetchData = () => 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 fetchData();
});
test('test', async t => {
await fetchAndMeasureDuration();
console.log(duration)?????
});