When placing a POST request with axios the second parameter is the JSON body object, so the options are not being passed correctly.
This could be corrected as:
if (this.httpFetch) return this.httpFetch(apiUrl, httpOptions)
else if (this.httpMethod === 'get') return axios.get(apiUrl, httpOptions)
else { // Is a POST request
let params = httpOptions.params
delete httpOptions.params
return axios.post(apiUrl, params, httpOptions)
}
Thanks, @mondul. Will checkout your PR later.
Can you provide a workaround until the correction is released ?
@rribou I'm looking for a cleaner way to fix this. In the meantime, you should be able to use http-fetch prop to assign your own AJAX function.
Something similar to this:
<template>
<vuetable ref="vuetable"
api-url="..."
:fields="..."
:http-fetch="myFetch"
></vuetable>
</template>
<script>
import axios from 'axios'
//..
methods: {
//..
myFetch (apiUrl, httpOptions) {
let data = {
// --- your key-value pair of data here ---
}
return axios.post(apiUrl, data, httpOptions)
}
}
</script>
Most helpful comment
@rribou I'm looking for a cleaner way to fix this. In the meantime, you should be able to use
http-fetchprop to assign your own AJAX function.Something similar to this: