define class for AdminPanel
This commit is contained in:
parent
1238a121f4
commit
7e8a857caf
@ -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');
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user