UNPKG

anthtrigger

Version:

Trigger events via http service

39 lines (36 loc) 1.29 kB
(function() { angular.module('anthTrigger').controller('dashboardController', function($rootScope, $scope, $cookies, $http, $location, notify) { var loadStatistic; loadStatistic = function() { $http.get('/dashboard/stats').success(function(resp) { return $scope.stat = resp.data; }).error(function() {}); $http.get('/dashboard/recentUser').success(function(list) { return $scope.recentUser = list; }); $http.get('/dashboard/recentRun').success(function(list) { return $scope.recentRun = list; }); return $http.get('/dashboard/usageStats').success(function(result) { return $scope.usageData = result; }); }; loadStatistic(); $scope.login = function(user) { return $http.post('/login', user).success(function(result) { if (result.success) { notify.closeAll(); $cookies.uid = result.user._id; return $rootScope.ReloadCurrentUser(); } else { return notify("登陆失败!"); } }).error(function() { return notify("登陆失败,服务器错误!"); })["finally"](function() { return loadStatistic(); }); }; }); }).call(this); //# sourceMappingURL=dashboardController.js.map