From 42d64f6431d2751f96223f7eadd2dffde78313f3 Mon Sep 17 00:00:00 2001 From: Aarni Date: Tue, 10 Jan 2017 19:12:35 +0200 Subject: [PATCH] Add timeout for empty rotation GET requests Resolve bug #12 --- infoscreen/static/js/infoscreen_controllers.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/infoscreen/static/js/infoscreen_controllers.js b/infoscreen/static/js/infoscreen_controllers.js index b5e518a..2df55b7 100644 --- a/infoscreen/static/js/infoscreen_controllers.js +++ b/infoscreen/static/js/infoscreen_controllers.js @@ -10,7 +10,12 @@ app.controller('infoscreen_main', function($scope,$http,$timeout){ $scope.index = -1; $http.get('/infoscreen/rotation/'+$scope.rotation, {timeout:5000}).then(function(response){ templates = response.data.instances; - $scope.next(); + if (templates.length == 0) { + $timeout(get_rotation, 10000); + } + else { + $scope.next(); + } },function(response){ $timeout(get_rotation, 10000); });