arbitrary query params?
Opened this issue · 1 comments
NullVoxPopuli commented
How do you add arbitrary params to a url?
openjck commented
I believe you can add them as properties on the object that is passed to the API endpoint. For example, with an API like the following:
import { buildApi, get } from 'redux-bees';
const apiEndpoints = {
getPost: { method: get, path: '/posts/:id' },
};
const config = {
baseUrl: 'https://api.yourservice.com'
};
const api = buildApi(apiEndpoints, config);
you could elsewhere do:
api.getPost({ id: 12, artist: 'PurrpleCat' })
which will send an HTTP request to the following URL:
https://api.yourservice.com/posts/12?artist=PurrpleCat