title: Vueresource wait for the previous http request to complete and then perform the next request
body: <p>Am trying to load a large dataset and break it down by fetching data in small intervals</p>
  
  <p>So that is</p>
  
  <p>Suppose i have 1000 records and i would like to get data in steps of 10 but only request the next 10 when the current request is complete</p>
  
  <p>so currently this is what am doing but its making multiple http requests and i cant know when one is complete or not</p>
  
  <pre><code>  processData(){
      this.fetchedtrucks = 0;
      this.dataLoadingCmplete = false;
      this.exportstart = true;
      this.ttatdatatrucks = [];
      let i = 0;
      do {
          const page = (i == 0) ? 0 : (i / (this.paginatorval));
          //send http request
  
            this.$http.get("v1/data-trucks",
                  {
                      from: this.duration_from,
                      to: this.duration_to,
                      page: page,
                      pagination: this.paginatorval,
                      filters: this.filters,
                      only_completed: this.only_completed,
                      non_reg: this.non_reg
                  }
              ).then(
                  res =&gt; {
                      this.ttatdatatrucks = this.ttatdatatrucks.concat(this.getTransformedData(res.ttatdata));
                      this.fetchedtrucks += this.paginatorval;
                      if (this.fetchedtrucks &gt;= this.totalRecords) {
                          this.dataLOadingCompleted();
                      }
  
  
                  }, err =&gt; {
                      this.fetchedtrucks += this.paginatorval;
                      this.errorloadingdata = true;
                  }
              )
  
          i += this.paginatorval;
  
      } while (i &lt; this.totalRecords);
  </code></pre>
  
  <p>The above works but not very neat as when i check on the browser dev tools i can see over 100 http requests issued what am looking forward to do is to issue the next http request only when the current request is completed</p>
  
  <p>How do i achieve this?</p>