{"size": 1511, "ext": "js", "max_stars_repo_path": "app/components/headerComponent/headerComponent.js", "max_stars_repo_name": "theAV/php_project", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "app/components/headerComponent/headerComponent.js", "max_issues_repo_name": "theAV/php_project", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "app/components/headerComponent/headerComponent.js", "max_forks_repo_name": "theAV/php_project", "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": 24.7704918033, "max_line_length": 140, "alphanum_fraction": 0.6267372601}
(function () {
	'use strict';

	// Usage: main header

	angular
		.module('MCWA')
		.component('headerComponent', {
			templateUrl: 'app/components/headerComponent/headerComponent.html',
			controller: HeaderController,
			controllerAs: 'vm',
			bindings: {
				userobj: '=',
			}
		});

	HeaderController.$inject = ['$scope', '$element', '$rootScope', '$state', '$transitions', 'REST_API', '$cookies', 'AuthenticationService'];

	function HeaderController($scope, $element, $rootScope, $state, $transitions, REST_API, $cookies, AuthenticationService) {
		var vm = this;
		////////////////
		vm.logo = "MCWA"
		vm.isuserauth = false;
		vm.userinfo;
		$rootScope.alerts = [];

		var logout = function () {
			REST_API.XHRCallApi('POST', 'get_logout').then(function (res) {
				var response_data = res.data;
				if (response_data.response_code === 200) {
					$rootScope.alerts.push({
						'type': 'active',
						'msg': response_data.message
					});					
					$rootScope.alerts = [];					
					AuthenticationService.removeCredentials();
					window.location = base_url;
				}else{
					AuthenticationService.removeCredentials();
					window.location = base_url;
				}

			}, function (res) {
				console.log('Wnkown Error');
			})

		}


		vm.$onInit = function () {
			if(vm.userobj.isAuthenticated){
				vm.logout = logout;
				vm.isuserauth = vm.userobj.isAuthenticated;
				vm.userinfo = vm.userobj.userinfo;
			}
		};
		vm.$onChanges = function (changesObj) {};
		vm.$onDestroy = function () {};
	}
})();
