var auth;
$(function(){
	$.post("System/api/am-i-logged-in", o=> {
		auth = o;
	}, 'json').fail(e=>{
		location.href = "login";throw '[aborting event chain (no error)]';
	});
});

/*
(function(){
	try {
		var u = JSON.parse(Cookies.get('authinfo'));
		auth = u;
		console.log(auth);
	}catch(e){
		alert('no auth');
		auth = {
			hid: 'IM39',
		}
	}
	Cookies.set('authinfo', JSON.stringify(auth));
	for(var i in auth)
		Cookies.set(i, auth[i]);
})();

$(function(){
	$.post("System/api/checklogin",	auth, o=> {
		
	}, 'json').fail(e=>{
		//alert('login fail');
		return false;
	});
});

*/