const notificationElement = document.getElementById("notification"); const apiProviderElement = document.getElementById("api-provider"); window.addEventListener("load", function () { apiProviderElement.href = `https://${api_provider}`; apiProviderElement.innerText = api_provider; if (docCookies.hasItem('token')) { document.getElementById('form').innerHTML = 'Already logged in! '; } }); document.getElementById("token-form").addEventListener("submit", async (e) => { e.preventDefault(); const token = document.getElementById("token").value; if (await getId(token).then(value => value['status'])) { docCookies.setItem("token", document.getElementById("token").value); window.location = "/"; } else { notificationElement.innerText = "Incorrect token!"; notificationElement.style.color = "red"; } });