text-display/public/js/login.js
2023-02-16 13:35:42 +00:00

18 lines
410 B
JavaScript

function formLink() {
let x = document.getElementById("Token").value;
const options = {method: 'POST', headers: {Token: x}};
fetch(location.protocol + '/login', options)
.then((response) => response.text())
.then(data => {
redirectOrNot(data);
})
.catch(err => console.log(err));
}
async function redirectOrNot(res) {
let url = location.protocol
location.href = url+res
}