Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It would be really useful if fetchOptions could allow to return a promise #326

Closed
richtera opened this issue Jun 29, 2019 · 2 comments
Closed

Comments

@richtera
Copy link

I created a simple version of this by copying the fetch.ts file and allowing fetchOptions to return a promise. The benefit is that if you have to wait for an access_token or anything you don't need to add logic to each of your urql queries. Is this something that's worth a pull request? I tried to make it an exchange, but there is no standard delay pipe operation in wonka so I gave up.

@kitten
Copy link
Member

kitten commented Jun 29, 2019

Duplicate of #234

This can also be done by writing a small exchange for modifying it on the fly.

Docs for Wonka are in progress and coming soon

@kitten kitten closed this as completed Jun 29, 2019
@richtera
Copy link
Author

richtera commented Jun 29, 2019

Any guidance how to write such exchange? I played around with this for about an hour or two.
Essentially I was unable to delay operations in the pipe until the token was available. I tried to subscibe to the original data and then sending it back out using a makeSubject, but that just caused a whole bunch of exceptions because it was expecting data instead of an uncompleted operation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants