Giter Site home page Giter Site logo

Interceptors about plugin-axios HOT 5 CLOSED

vuex-orm avatar vuex-orm commented on May 12, 2024 3
Interceptors

from plugin-axios.

Comments (5)

nmihaica avatar nmihaica commented on May 12, 2024

Axios is bundled with plugin
https://github.com/vuex-orm/plugin-axios/blob/master/src/orm/axios.js

Use wrapper methods to guide reponses accordingly
like

onResponse(response) {
  return response.data;
}

~

However, I agree that it should be enhancement if axios was dynamically injected with seperate instance. I think authors wanted to keep plugin simple and 'pluggable' with this approach.

from plugin-axios.

mdbetancourt avatar mdbetancourt commented on May 12, 2024

@nmihaica and how i can use an adapter like https://github.com/ctimmerm/axios-mock-adapter when need pass the axios instance

from plugin-axios.

nmihaica avatar nmihaica commented on May 12, 2024

I would then stick with plain axios and axios-mock-adapter packages without vuex-orm.

from plugin-axios.

geogeorgiev avatar geogeorgiev commented on May 12, 2024

It would be nice to have interceptors for adding a trailing slash as in this example axios/axios#757 (comment)

from plugin-axios.

 avatar commented on May 12, 2024

I agree too. This would be nice, because currently I have other actions on my API that aren't CRUD and I already have the interceptor setup for the calls that pass by vanilla axios.
I wouldn't want to duplicate the logic in my interceptor and also in the custom hooks you defined for axios.

Please allow us to use the interceptor of axios itself!

from plugin-axios.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.