Skip to content
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

Add create config option for custom axios instance #205

Closed
sky-code opened this issue Mar 17, 2019 · 1 comment
Closed

Add create config option for custom axios instance #205

sky-code opened this issue Mar 17, 2019 · 1 comment

Comments

@sky-code
Copy link

sky-code commented Mar 17, 2019

I use axios from @nuxtjs/axios and I want to pass already created and configured axios instance in apisauce.
At this moment axios instance created from config parameters and then used by local instance variable, so this instance can't be changed.
src: https://github.com/infinitered/apisauce/blob/master/lib/apisauce.ts#L135
Can we add optional config parameter axiosInstance and then check if it set, use it, otherwise create new axios instance.

export const create = config => {
  let instance = config.axiosInstance
  if(!instance){
    instance = axios.create(combinedConfig)
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants