your request function doesn't return the json result, only logs it. The function still returns a promise in my code, is it normal behavior? should the request function be sync when called as const res = request() ?
const res = request()
ahh the function wrapping that should also be async, so it should be like:
const useRequest = async () => { const res = await request() } useRequest()
given that you return the json instead of just logging it in the request() function.
json
request()
Exactly what I needed to know too - thanks!
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
your request function doesn't return the json result, only logs it. The function still returns a promise in my code, is it normal behavior? should the request function be sync when called as
const res = request()
?
ahh the function wrapping that should also be async, so it should be like:
given that you return the
json
instead of just logging it in therequest()
function.Exactly what I needed to know too - thanks!