Giter Club home page Giter Club logo

fetch-interceptor's People

Contributors

dependabot[bot] avatar itsfadnis avatar yuanxiaoo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

fetch-interceptor's Issues

Few info which were not mentioned on Doc.

Hi, i was looking for angular Http interceptor alike code, for my react-native project and found this package. As i am new to react-native so having some problem while implementing this package on my project.

I have followed the doc an implemented it in my code. Now the thing is being not able to modify the error message when it request or response fails.

How can i make the re-use of "fetch-interceptor" across multiple files.

Didn't find any guide for implementing AbortSignal as i was happy to see that this package is also loaded with AbortController but failed to use it.

Any kind of info would be of much help. thanks.

I tried your project but doesnt seem to work

So based on your documentation i added the following to my application. as you can see i just added simple console statements to prove it was working. i get the "onBeforeRequest" and nothing else. In my case i watch to catch all 401 but based on this example thats not going to work. As a result im going to uninstall but i wanted to give you feed back before i did.

import FetchInterceptor from 'fetch-interceptor'

// Register interceptor hooks
const interceptor = FetchInterceptor.register({
  onBeforeRequest(request, controller) {
    // Hook before request
    console.log("onBeforeRequest")
  },
  onRequestSuccess(response, request, controller) {
    // Hook on response success
     console.log("onRequestSuccess")
  },
  onRequestFailure(response, request, controller) {
    // Hook on response failure
    console.log("onRequestFailure")
  }
});

// Make fetch requests to see interceptor in action
fetch('http://whatever.com/whatever');

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.