jamesdordoy / laravel-vue-datatable

Vue.js Datatable made for Laravel
https://jamesdordoy.github.io/laravel-vue-datatable
MIT License
151 stars 52 forks source link

Axios as a prop #134

Closed neilherbertuk closed 2 years ago

neilherbertuk commented 3 years ago

Hi @jamesdordoy,

I'm writing an SPA where I want to use laravel-vue-datatable, however, my project uses @websanova/vue-auth and vue-axios. Vue-auth injects bearer tokens into axios automatically and I have some config that sets some of the axios default config across the application such as prefixing all urls etc.

What would be neat would be a way of passing in an existing instance of axios as a prop or something. I appreciate that you have already added a way to add headers via a prop, but that doesn't help with things like overriding axios.defaults.

I'm having difficulty getting my environment setup to be able to compile and make a PR for this but I can imaging having a prop and in the created lifecycle hook either using whats been passed in via the prop, or if thats not been set requiring axios like you are with the lodash.debounce.

I supose the alternative would be to check if Vue.axios or Vue.$http is set and using that or requiring axios would perhaps be simplier.

Neil

jamesdordoy commented 2 years ago

Hey Neil,

What version of vue are you using and are you still interested in using this package?

Im going to push for a rewrite in vue 3 rather than wasting time on legacy code and features but let me know what your implementation looks like or email me and ill try to help.