genofire/hs_monolith
genofire
/
hs_monolith
Archived
1
0
Fork 0
This repository has been archived on 2020-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
hs_monolith/webroot/static/js/global.js

24 lines
644 B
JavaScript

'use strict';
angular.module('microStock')
.controller('GlobalCtrl',['$scope',function($scope){
$scope.loggedIn = false;
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
var expires = "expires="+d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
$scope.login = function(){
if($scope.loggedIn){
setCookie("session","logoff",1);
$scope.loggedIn = false;
}else {
setCookie("session","testsessionkey",1);
$scope.loggedIn = true;
}
};
}]);