I'm trying to wrap fetch() and return the JSON data from it:
function testFetch() {
    fetch('/xxx/').then(
        (resp) => {
            resp.json().then((data) => {
                console.log('inside', data)
                return data
            })
        }).catch((err) => {
            console.log('error', err)
        })
}
console.log(testFetch())
It obviously does not work, how can I wait for fetch() to complete?
 
    