app_lisium/static/js/loginHandler.js
2025-12-13 10:23:28 -06:00

32 lines
870 B
JavaScript

document.addEventListener('DOMContentLoaded', async function() {
console.log("here i am")
});
async function authenticateLogin() {
var username = document.getElementById('login_username').value;
var password = document.getElementById('login_password').value;
const response = await fetch('/login/authenticate', {
method: 'POST',
headers:{
'Content-Type': 'application/json'
},
body: JSON.stringify({
user_username: username,
user_password: password
}),
});
data = await response.json()
console.log(data)
if (data.error){
UIkit.notification({
message: data.message,
status: "danger",
pos: 'bottom-right',
timeout: 5000
});
} else if (!data.error) {
window.location.href = '/';
}
}