janiskelemen / formvuelar

Vue form components with server-side validation in mind
https://janiskelemen.github.io/formvuelar/
MIT License
300 stars 25 forks source link

Use different axios instance? #11

Closed dnldsht closed 4 years ago

dnldsht commented 4 years ago

I cant find a way to use a custom instance of axios?

It will be nice to use it so you can use the interceptors, a baseUrl, default headers and other stuff.

I implemented it like this but don't know if its the right way

...

let method = this.multipart && (this.method == 'patch' || this.method == 'put') ? 'post' : this.method

// this chage
let _axios = this.axios || this.$http || axios

_axios({
 method: method,
 url: this.url,

...
janiskelemen commented 4 years ago

Hi,

you can add custom axios headers using the config -> https://formvuelar.netlify.com/#/config

dnldsht commented 4 years ago

I've seen that you can use custom headers, but it's not the same as using your axios instance

On Tue, Jul 23, 2019, 11:03 PM Janis Kelemen notifications@github.com wrote:

Hi,

you can add custom axios headers using the config -> https://formvuelar.netlify.com/#/config

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/janiskelemen/formvuelar/issues/11?email_source=notifications&email_token=ABIHGAFO5ERMNAS4HBHL5ATQA5W2JA5CNFSM4IFHGS52YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2UN2DI#issuecomment-514383117, or mute the thread https://github.com/notifications/unsubscribe-auth/ABIHGAFV6RC56HLIPM6B4HDQA5W2JANCNFSM4IFHGS5Q .

janiskelemen commented 4 years ago

Unfortunately, it's not possible to share the same instance. However, all additional headers and configs for axios can be set via the global formvuelar config.