title: Abort all axios pending requests and create new
body: <p>I am using <code>axios</code> for API requests, I have a situation where I want to abort all running/pending requests and create new with another API.</p>
  
  <p>Have tried below code</p>
  
  <pre><code>async getOldResponse() {
      const response_old: any = await this.axios.post("/search_old", this.searchData);
      console.log(response_old)
  }
  async getOldOtherResponse() {
      const response_old_second: any = await this.axios.post("/search_old_second", this.searchData);
      console.log(response_old_second);
  }
  async getNewSearch() {
      // here i want to cancel all pending requests.
      const CancelToken = this.axios.CancelToken;
      const source = CancelToken.source();
      source.cancel('All previous pending request cancelled');
      const response: any = await this.axios.post("/search_new", this.searchData);
      console.log(response);
  }
  ngOnInit() {
      this.getOldResponse();
      this.getOldOtherResponse();
      this.getNewSearch();
  }
  
  </code></pre>
  
  <p>Basically I want to abort <code>/search_old</code> &amp; <code>search_old_second</code> API requests and create <code>search_new</code>.</p>