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

arbitrary query params? #40

Open
NullVoxPopuli opened this issue Jan 5, 2018 · 1 comment
Open

arbitrary query params? #40

NullVoxPopuli opened this issue Jan 5, 2018 · 1 comment

Comments

@NullVoxPopuli
Copy link

How do you add arbitrary params to a url?

@openjck
Copy link

openjck commented Jan 31, 2022

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

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