remember login state, and check if user is logged in on page

This commit is contained in:
2019-09-27 16:37:59 +02:00
parent 06c24185d2
commit 6c3e4cece2
11 changed files with 267 additions and 19 deletions

2
wwwroot/js/profile.js Normal file
View File

@ -0,0 +1,2 @@
$(document).ready(function() {
});

View File

@ -1,3 +1,20 @@
$(document).ready(function() {
console.log("hey from js");
//check login state
console.log("page loaded");
$.post('/senddata/checkloginstate','action=getloginstate',function(data){
console.log(data);
if (data.loggedin == true) {
$("#userlabel").html(" "+data.username);
}else{
$("#userlabel").html(" not logged in!!");
}
},'json');
$('#logoutbtn').click(function() {
$.post('/senddata/checkloginstate','action=logout',function(data){
console.log(data);
},'json');
});
});