FeatureFuel
1

SDK API design question: why "client.request" requires a **function** as unique argument ?

Source: directus/directus#23147 · opened by @pomeh
Summary I don't understand why the client.request requires a function as argument, as this complexifies some code when you want to customize the request for example. Basic Example Using the JS SDK and according to the documentation, I need to use this syntax to get items from a collection: For some reasons, I need to edit the request before sending it, so I need to extend the result from readItems before passing it to client.request func. Basically, I would have done is this way: It turns out, the code above does not work, and it seems it's because of a simple reason: request func accepts a function as argument, and not an object. Out of curiosity, I look out the [request source code]( to understand why it was designed this way: But as we can see, we only call the getOptions function as is, without any added argument or anything else, so I guess having an object in the first place would have ended with the same result. Motivation By accept…

No pledges yet. Be the first to back this.

Make a pledge

Pledge your monetary support if this feature is added.

$

Comments

No comments yet.

Replying to

Add a comment

What do you think about this feature request?


Similar requests