vue-authenticate
vue-authenticate copied to clipboard
how to replace Axios with another library?
I am using https://github.com/twg/devour to handle my JSON API requests. How to use it instead of Axios?
Hi, unfortunately, this is very small and rather unknown library to be implemented. What I recommend to create wrapper plugin library that will handle sending requests in vue-authenticate. You can even create a plugin, for example vue-authenticate-devour and publish it and I'll be glad to support it officially.
That's good to know. Is there an example of a wrapper plugin that I can use? I tried to play with the plugin factory method but could not get through.
Unfortunately, no. You'll have to google that yourself. You can check out how I did it here: https://github.com/dgrubelic/vue-authenticate/blob/master/src/index.js#L10 any try to implement it yourself.
I mean how to inject the $http into vue-authenticate before adding it to Vue plugins?
In Vue2 could probably just do the following:
Vue.prototype.$http = axios.create();
If you replace axios with anything else, you'll just need to make sure the function calls are compatible with the way this package uses it.