text-display/public/js/login.js

17 lines
443 B
JavaScript
Raw Normal View History

2023-02-16 12:30:06 +00:00
function formLink() {
let x = document.getElementById("Token").value;
const options = {method: 'POST', headers: {Token: x}};
fetch('http://127.0.0.1:8000/login', options)
.then((response) => response.text())
.then(data => {
redirectOrNot(data);
})
.catch(err => console.log(err));
}
async function redirectOrNot(res) {
let url = "http://" + location.hostname + ":" + location.port
location.href = url+res
}