Stop polling if receive 401 response

This commit is contained in:
uu59 2014-06-03 15:46:14 +09:00
parent 51d7bf3309
commit 4baf45c36a

View File

@ -15,10 +15,14 @@
var fetch = function(){ var fetch = function(){
self.fetchAlertsData().then(function(alerts){ self.fetchAlertsData().then(function(alerts){
self.alerts = alerts; self.alerts = alerts;
})["catch"](function(xhr){
if(xhr.status === 401) {
clearInterval(timer);
}
}); });
}; };
fetch(); fetch();
setInterval(fetch, POLLING_INTERVAL); var timer = setInterval(fetch, POLLING_INTERVAL);
}, },
computed: { computed: {