title: How to avoid sending multiple duplicate AJAX requests in axios
body: <p>Is it possible to automatically throttle all requests going to a particular list of endpoints using axios? Perhaps using axios interceptor?</p>
  
  <p>Currently I throttle the user action that sends the axios request, but the problem with that is that I have to write this everywhere I have a user action that results in some AJAX request. Like this</p>
  
  <pre><code>  const throttledDismissNotification = throttle(dismissNotification, 1000)
  
    const dismiss = (event: any) =&gt; {
      throttledDismissNotification();
    };
  
    render() {
      return (
        &lt;Button onClick={dismiss}&gt;Dismiss Notification&lt;/Button&gt;
      )
    }
  
  </code></pre>
  
  <p>This results in a lot of clutter and I was wondering if this could be automated.</p>
  
  <p>Something like:</p>
  
  <pre><code>if(request.url in listOfEndpointsToThrottle &amp;&amp; request.params in cacheOfPreviousRequestsToThisEndpoint) {
    StopRequest();
  }
  </code></pre>
  
  <p>Obviously this is pseudocode but you get the idea.</p>