I can't work out or understand how to return the nestled .then methods resolved value to the function that called it.
How can I return the value from the resolved promise that is nestled to the and then console.log()
in that function that calls it.
connectedCallback () {
this.input.addEventListener('input', event => {
this.search(this.input.value)
})
}
search (str) {
let searchResult = window.fetch(`http://localhost:3000/api/?q=${str}`)
.then(result => {
return result.json()
.then(result => {
return result
})
})
}
}