Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Reload code after $http.get('/') #666

Open
dianavillegas opened this issue Dec 22, 2017 · 0 comments
Open

Reload code after $http.get('/') #666

dianavillegas opened this issue Dec 22, 2017 · 0 comments

Comments

@dianavillegas
Copy link

Is there another way to reload the request after it has loaded successfully? We were using setTimeout to reload the code however the response data is fluctuating or is not accurate for every load.

`fetchFinished: function(){

        var vm = this;
        var finishedtodays = [];
        var pendingsss = [];

       vm.$http.get('/test').then(function(response){

         this.finishedtoday = [];
         this.pendingtasks = [];
      
          var name = response.body.daily;
          var name2 = response.body.pending;
          vm.tablecounts = name;
          console.log('test1')
          //for finsihed today
          name.forEach(function(key, value){
            var count = key.daily_count;
            var name = key.name

            finishedtodays.push({"name": name.split(" ")[0], "count": count});

          });

          //for pending tasks

           name2.forEach(function(key, value){
            var firstname = key.name
            var count = key.count

            pendingsss.push({"name": firstname.split(" ")[0], "count": count});

           });
          vm.finishedtoday = finishedtodays;
          vm.pendingtasks = pendingsss;
          //for fetching all
          vm.allcounts = response.body.allcount;

          console.log("Test run");            

        }).catch(function(error){
        });

       setTimeout(this.fetchFinished.bind(this), 1000);
       //setInterval(this.fetchFinished.bind(this), 10000); 
      // this.$forceUpdate();
      }`
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant