Axios request config params object
See original GitHub issueHi, how can i use Axios request config params object for Resource object actions? Action of Resource object has function pathFn for adding some parameters to the URL, but i need add some handy parameters with stringifying needing and Axios has paramsSerializer function for that (usable with Qs library). Please, how can i use Axios paramsSerializer function with your helper?
Resource object wrapper with configured Axios instance and paramsSerializer option:
import Qs from 'qs'
import Axios from 'axios'
import { Resource } from 'vuex-rest-api'
export default class ResourceWrapper {
constructor(baseURL = null, options = {}) {
baseURL = baseURL || 'http://localhost:8003/api/admin'
options.axios = Axios.create({
paramsSerializer: function(params) {
return Qs.stringify(params, {arrayFormat: 'indices'})
}
})
return new Resource(baseURL, options)
}
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Request Config | Axios Docs
These are the available config options for making requests. ... `params` are the URL parameters to be sent with the request // Must...
Read more >Use Axios.Get with params and config together - Stack Overflow
Axios takes the entire config in the second argument, not a list of config objects. Put the params inside the config, and pass...
Read more >Axios Cheat Sheet - Kapeli - Dash for macOS
Make a request for a user with a given ID axios.get('/user? ... be sent with the request // Must be a plain object...
Read more >GET Request Query Params with Axios - Mastering JS
The easiest way to make a GET request with Axios is the axios.get() function. The 2nd parameter to axios.get() is the Axios options:...
Read more >Understanding Axios GET requests - LogRocket Blog
Learn how to make GET requests in Axios with query parameters and API keys, plus concurrent and HEAD requests and error handling.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Great idea. I’ll change this tomorrow and let you know!
If I add the check constraint it is indifferent if you just do it on one action or the axios instance.
Thank you again, it is working, all is only about implementation.