59 lines
No EOL
1.5 KiB
JavaScript
59 lines
No EOL
1.5 KiB
JavaScript
async function auth(event) {
|
|
event.preventDefault();
|
|
const text = event.target.elements.adminpassword.value;
|
|
const response = await adminauth(text);
|
|
if (response.status !== 200) {
|
|
alert(response.msg)
|
|
} else {
|
|
document.getElementById("admin").classList.remove("hidden")
|
|
document.getElementById("login").classList.add("hidden")
|
|
}
|
|
return false;
|
|
}
|
|
|
|
async function submit() {
|
|
let text = document.getElementById("query").value
|
|
let response = await adminquery(text)
|
|
alert(response.msg)
|
|
}
|
|
|
|
async function posts() {
|
|
let response = await adminposts();
|
|
if (response.status !== 200) {
|
|
alert(response.msg)
|
|
return
|
|
}
|
|
let table = document.getElementById("table")
|
|
table.innerHTML = response.msg
|
|
}
|
|
|
|
async function users() {
|
|
let response = await adminusers();
|
|
if (response.status !== 200) {
|
|
alert(response.msg)
|
|
return
|
|
}
|
|
let table = document.getElementById("table")
|
|
table.innerHTML = response.msg
|
|
}
|
|
|
|
async function sessions() {
|
|
let response = await adminsessions();
|
|
if (response.status !== 200) {
|
|
alert(response.msg)
|
|
return
|
|
}
|
|
let table = document.getElementById("table")
|
|
table.innerHTML = response.msg
|
|
}
|
|
|
|
async function load() {
|
|
let check = await admincheck();
|
|
if (check.msg === "true") {
|
|
document.getElementById("admin").classList.remove("hidden")
|
|
} else {
|
|
document.getElementById("login").classList.remove("hidden")
|
|
}
|
|
}
|
|
|
|
load() |