define class for AdminPanel

This commit is contained in:
Lukas-Heiligenbrunner 2020-02-10 11:16:44 +01:00
parent 1238a121f4
commit 7e8a857caf
2 changed files with 38 additions and 27 deletions

View File

@ -1,5 +1,14 @@
$(document).ready(function () {
console.log("page loaded");
new AdminPanel();
});
class AdminPanel {
constructor() {
this.checkLoginState();
this.addClickListeners();
}
checkLoginState(){
$.post('/senddata/checkloginstate', 'action=getloginstate', function (data) {
console.log(data);
if (data.loggedin == true) {
@ -11,8 +20,9 @@ $(document).ready(function () {
$("#userlabel").html(" not logged in!!");
}
}, 'json');
}
addClickListeners(){
$("#btn-shutdown").click(function (event) {
console.log("shutting down server");
@ -31,4 +41,5 @@ $(document).ready(function () {
}, 'json');
});
});
}
}