se-hub/templates/js/controllers/mainController.js

21 lines
598 B
JavaScript
Raw Normal View History

2015-05-09 19:00:14 +00:00
angular.module('SeHub')
.controller('mainController', ['$scope', '$rootScope', 'apiService', '$cookies', '$location', function ($scope, $rootScope, apiService, $cookies, $location) {
$rootScope.seToken = $cookies['com.sehub.www'];
var token = $rootScope.seToken;
$scope.loadingData = true;
apiService.getUserByToken(token).success(function(data){
2015-06-09 17:16:29 +00:00
console.log(data);
2015-05-09 19:00:14 +00:00
if(data.message == 'No User Found')
console.error("No User Found!");
2015-06-09 17:16:29 +00:00
$scope.user = data;
$rootScope.user = data;
2015-05-09 19:00:14 +00:00
if($scope.user.isFirstLogin)
$location.path('/register')
})
$scope.loadingData = false;
}]);