text-display/public/js/login.js

19 lines
410 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}};
2023-02-16 13:35:42 +00:00
fetch(location.protocol + '/login', options)
2023-02-16 12:30:06 +00:00
.then((response) => response.text())
.then(data => {
redirectOrNot(data);
})
.catch(err => console.log(err));
}
async function redirectOrNot(res) {
2023-02-16 13:35:42 +00:00
let url = location.protocol
2023-02-16 12:30:06 +00:00
location.href = url+res
2023-02-16 13:35:42 +00:00
}