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
Feature request: Query params #17
Comments
I like both ideas. 👍 Just one suggestion, instead connect(({ name }) => ({
barFetch: {
url: `/foos/${name}`,
query: { foo: verifyFoo(), bar: verifyBar() }
transform: ({ foos, page }) => ({ bars: foos, page }),
then: (foo) => `/bar-for-foos-by-id/${foo.id}`
}
})) |
That's even better! :) |
If you approve the syntax I'll be happy to create a pull request. |
To do the data transform, you should be able to use then() on the PromiseState instead of on the request in connect(). The latter will fire off a new request, which is probably not what you want. |
@hnordt do you mean call the 'query' attribute 'data' (and maybe also share it with 'body') like jquery does? I wasn't following your example in relation to the issue. |
Also, can we please break this into two separate issues? :) |
@ryanbrainard I think transforming data on PromiseState is ok, better than add a new prop. About connect(({ name }) => ({
barFetch: {
url: `/foos/${name}`,
query: { foo: 'bar', bar: 'foo' }
}
}))
// barFetch should request /foos/${name}?foo=bar&bar=foo I think objects are better than raw string for query params because we can do things like this: { query: Object.assign({ foo: 'bar' }, { bar: testBar() ? 'foo' : null }) } |
Moved discussion of transform functions to #21 |
I've been thinking about this, and I've decided to decline on this feature for the following reasons:
|
Nice library, thanks for creating it!
What do you think about adding some convenience features?
Url query params
The text was updated successfully, but these errors were encountered: