Closed xpuu closed 4 years ago
Hi @xpuu,
P.S. Many thanks for your lovely little library.
❤️
But it doesn't work as expected, because get() in this case doesn't return a promise. Would you be so kind and correct my dellusions? Here's is the fiddle.
Sure, I think you forgot to return
the resolver.
let w = wretch('https://reqres.in/api/users/2').resolve(resolver => {
// Missing "return" keyword - or remove the curly braces:
return resolver.res(res => {
output(Array.from(res.headers.entries()))
return res.json()
})
})
w.get().then(res => output(res))
I have to connect to an API, which is constantly regenerating its authentication token. I thought it'd be nice use case for a resolver. But it doesn't work as expected, because
get()
in this case doesn't return a promise. Would you be so kind and correct my dellusions? Here's is the fiddle.P.S. Many thanks for your lovely little library.