Skip to content

Commit e21257c

Browse files
committed
refresh the data periodically
1 parent a79411e commit e21257c

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

src/assets/javascripts/app.js

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,13 @@ Vue.component('relative-time', {
204204

205205
var vm = new Vue({
206206
created: function() {
207-
this.refreshStats()
208-
.then(this.refreshFeeds.bind(this))
209-
.then(this.refreshItems.bind(this, false))
210-
211-
api.feeds.list_errors().then(function(errors) {
212-
vm.feed_errors = errors
213-
})
207+
this.refreshAll()
208+
this.interval = setInterval(function() {
209+
this.refreshAll()
210+
}.bind(this), 600000) // every 10 minutes
211+
},
212+
destroyed: function() {
213+
clearInterval(this.interval)
214214
},
215215
data: function() {
216216
var s = app.settings
@@ -252,6 +252,7 @@ var vm = new Vue({
252252
'refreshRate': s.refresh_rate,
253253
'authenticated': app.authenticated,
254254
'feed_errors': {},
255+
'interval': null,
255256
}
256257
},
257258
computed: {
@@ -396,6 +397,15 @@ var vm = new Vue({
396397
})
397398
})
398399
},
400+
refreshAll: function() {
401+
this.refreshStats()
402+
.then(this.refreshFeeds.bind(this))
403+
.then(this.refreshItems.bind(this, false))
404+
405+
api.feeds.list_errors().then(function(errors) {
406+
vm.feed_errors = errors
407+
})
408+
},
399409
getItemsQuery: function() {
400410
var query = {}
401411
if (this.feedSelected) {

0 commit comments

Comments
 (0)