{"size": 777, "ext": "js", "max_stars_repo_path": "client/controllers/userControls.js", "max_stars_repo_name": "KyleW/eatChallenge", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "client/controllers/userControls.js", "max_issues_repo_name": "KyleW/eatChallenge", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "client/controllers/userControls.js", "max_forks_repo_name": "KyleW/eatChallenge", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 28.7777777778, "max_line_length": 80, "alphanum_fraction": 0.5328185328}
(function() {
    'use strict';

    angular
      .module('eatChallengeApp')
      .controller('userControlsController', userControlsController);
    userControlsController.$inject = ['$rootScope', '$scope', '$state', 'auth'];
    function userControlsController($rootScope, $scope, $state, auth) {
        var vm = $scope;
        vm.loggedIn = auth.getUserStatus();
        vm.logout = logout;
        vm.user = $rootScope.user;
        /////////////////////////
        function logout() {
            auth.logout();
            vm.loggedIn = auth.getUserStatus();
            $state.go('saveAndExit');
        }

        $rootScope.$watch('user', function() {
            vm.loggedIn = auth.getUserStatus();
            vm.user = $rootScope.user;
        });
    }

})();
