make-service icon indicating copy to clipboard operation
make-service copied to clipboard

Make addQueryToURL more full featured

Open gustavoguichard opened this issue 1 year ago • 3 comments

I'd like to construct a QS as complex as 'filter[0]["key"]=value&filter[0]["op"]=gte&filter[0]["value"]=0' out of an object like:

addQueryToURL(`http://localhost:3000`,  { filter: [{ key: "value", op: "gte", value: 0 }] });

gustavoguichard avatar Mar 07 '24 13:03 gustavoguichard

What do you think about having something like this: 'filter["key"]=value&filter["op"]=gte&filter["value"]=0? There might be a specific reason for how you're positioning the filters, and if that's the case, please let me know.

How would you expect those filters to appear in the url response?

Mario-aj avatar Jun 13 '24 08:06 Mario-aj

Hey @Mario-aj, thank you for showing interest!

There's no pattern when it comes to this problem. That is why Id rather follow the same behavior as the qs library. It is also the exact inverse of composable-functions' inputFromSearch if you'd like to see a smaller code.

gustavoguichard avatar Jun 14 '24 10:06 gustavoguichard

Hey @gustavoguichard, thanks for the recommendation! I'll definitely check out these libraries.

Mario-aj avatar Jun 24 '24 13:06 Mario-aj