GithubHelp home page GithubHelp logo

Middleware feature about apisauce HOT 6 CLOSED

infinitered avatar infinitered commented on July 19, 2024 3
Middleware feature

from apisauce.

Comments (6)

skellock avatar skellock commented on July 19, 2024 4

Ok, new version is out. It has this feature now:

https://github.com/skellock/apisauce#adding-transforms

Thx.

from apisauce.

maluramichael avatar maluramichael commented on July 19, 2024 1

Wow that was fast. Thank you so much.

from apisauce.

BigPun86 avatar BigPun86 commented on July 19, 2024 1

Great work @skellock

from apisauce.

skellock avatar skellock commented on July 19, 2024

That's what addMonitor does, but I think I might not be reading you right.

Are you looking for an opportunity to change the response somehow before it gets to your normal path of execution?

from apisauce.

maluramichael avatar maluramichael commented on July 19, 2024

Yeah thats what i want to do. I have an api which sends some useless data so i want to clean all responses.

from apisauce.

maluramichael avatar maluramichael commented on July 19, 2024

Now i do this for all of my api requests:

all() {
    return this.api.get('/business_stores').then(CleanupResponse);
}

But it would be nice if i could do something it like this:

this.api.addMiddleware(response=>{
    return CleanupResponse(response);
});

This middleware would be called right after the response is received from the server and passed to the first then.

from apisauce.

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.