-
Notifications
You must be signed in to change notification settings - Fork 15
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
How do you send body data with post requests using ApiGroup? #16
Comments
Did you create a Group? export const widgets = new ApiGroup(axios, {
search: 'courses',
update: 'POST products/widgets/:id',
delete: 'DELETE products/widgets/:id',
})
widgets.update({ id: 1, foo: 1 }) There's another ticket here, is that related? |
Yes I am creating a group.
But this code just replaces foo and id like this:
becomes
but I am trying to send data. How do I do that? I dont think that the tickets are related. |
If you can update that last comment with full code so I can see what's happening, that would be helpful. The URL will consume any placeholders, but the data should be sent in the POST body. It's been a while since I looked at the code, so I might need to confirm if the full object is sent (I think it is) or the consumed fields are removed. |
I am literally not doing anything beside following the example code in the docs for ApiGroup. That's why I am asking for help. You're completely right that the data should be sent through the POST body. But how do you do it? Do you have any examples I could look at? |
Oh, so this is a question not a bug? Any data you pass will be sent through the post body. Did you check the network panel? From the demo: |
Yes this is a question. The example code is in vue so I dont really understand it. Could you please post some examples in vanilla js? Its a really simple question. How do I send data with post requests? If I had a login route, how would I send the email & password? |
This is the docs index page; every page has multiple examples, all in vanilla JS: If you can't find or understand the examples, then that's not something I can help you with. If you had a login route, you'd probably just send the username and password with a normal API call; AxiosActions is designed for sets of actions that you don't want to repeat in multiple places. A login will only be in one place. |
Arent you one of the contributors? How can you not help me?
The code above exec the login action and gets the response. Now where in this code can I send the login info? I dont know why you keep referring to the docs because they dont have any examples... |
I already did:
Every page has multiple usage examples: There is also a working demo for every class... ...each of which links to the related:
|
How do you do it? I dont find any examples in the docs.
And the code below just replaces id.
widgets.use('update', 1)
But how can I send body data?
The text was updated successfully, but these errors were encountered: