How to call async function from regular sync function?
getCategoryAll() doesn't work on page load as it works correctly when I type it into console. What I should change to make my function call giving an output that I expect?
async function getCategory(catId) {
const response = await axios.get...
// my code here
}
function getCategoryAll() {
// my for loop logic here referring to getCategory(catId)
}
getCategoryAll()
Right now solution what I have is delaying execution of 2nd function which is obviously not the best solution
setTimeout(() => getCategoryAll(), 500);