1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Fixed bug with setting cookie

This commit is contained in:
Krateng 2019-06-18 10:32:29 +02:00
parent 90b510bc0a
commit aeaaf3a8e9

View File

@ -38,13 +38,16 @@ function saveCookies() {
function insertAPIKeyFromCookie() {
getCookies();
key = cookies["apikey"];
document.getElementById("apikey").value = key;
checkAPIkey()
if (key != null && key != undefined) {
document.getElementById("apikey").value = key;
checkAPIkey();
}
}
function saveAPIkey() {
key = APIkey()
setCookie("apikey",key)
key = APIkey();
setCookie("apikey",key);
}
@ -57,6 +60,7 @@ function checkAPIkey() {
if (this.readyState == 4 && (this.status == 204 || this.status == 205)) {
document.getElementById("apikey").style.backgroundColor = "lawngreen"
apikeycorrect = true
saveAPIkey();
}
else {
document.getElementById("apikey").style.backgroundColor = "red"
@ -71,9 +75,6 @@ function checkAPIkey() {
document.getElementById("apikey").style.backgroundColor = "red"
apikeycorrect = false
}
if (apikeycorrect) {
saveAPIkey();
}
}
function APIkey() {