diff --git a/front/static/js/login.js b/front/static/js/login.js index 66fd76f..900271d 100644 --- a/front/static/js/login.js +++ b/front/static/js/login.js @@ -13,7 +13,7 @@ function postToLoginEndpoint(event) { const url = "https://reqres.in/api/login" // mock api service const xhr = new XMLHttpRequest(); - console.log(`User credentials:\n${JSON.stringify(credentials)}`); + console.log("User credentials:\n" + JSON.stringify(credentials)"); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/json"); @@ -21,14 +21,14 @@ function postToLoginEndpoint(event) { if (this.readyState === 4) { if (this.status === 200) { console.log("LOGIN SUCCESS!"); - console.log(`Server response:\n${this.response}`); + console.log("Server response:\n" + this.response); token = JSON.parse(this.response).token; localStorage.setItem("token", token); window.location.replace("home.html"); } else { console.error("LOGIN FAILURE!"); - console.error(`Server status: ${this.status}`); - console.error(`Server response:\n${this.response}`); + console.error("Server status: " + this.status); + console.error("Server response:\n" + this.response); displayErrorMessage(this.response); } } diff --git a/front/static/js/logout.js b/front/static/js/logout.js index 4cdc571..c10c381 100644 --- a/front/static/js/logout.js +++ b/front/static/js/logout.js @@ -6,18 +6,18 @@ function postToLogoutEndpoint(event) { const xhr = new XMLHttpRequest(); xhr.open("POST", url, true); - xhr.setRequestHeader("Authorization", `Token ${token}`); + xhr.setRequestHeader("Authorization", "Token " + token); xhr.onreadystatechange = function() { if (this.readyState === 4) { if (this.status === 200) { console.log("LOGOUT SUCCESS!"); - console.log(`Server response:\n${this.response}`); + console.log("Server response:\n" + this.response); localStorage.removeItem("token"); window.location.replace("index.html"); } else { - console.log("LOGOUT FAILURE!"); - console.log(`Server status: ${this.status}`); - console.log(`Server response:\n${this.response}`); + console.error("LOGOUT FAILURE!"); + console.error("Server status: " + this.status); + console.error("Server response:\n" + this.response); } } }; diff --git a/front/static/js/viewHistory.js b/front/static/js/viewHistory.js index ef76121..e4e78d2 100644 --- a/front/static/js/viewHistory.js +++ b/front/static/js/viewHistory.js @@ -14,7 +14,7 @@ function getEndpointDomain() { else OSName = "Unknown OS"; - console.log(`Detected operating system: ${OSName}`); + console.log("Detected operating system: " + OSName); if (OSName === "Windows") { domain = "https://192.168.99.100:8444/"; @@ -30,20 +30,20 @@ function getDataFromEndpoint(url, callback) { const token = localStorage.getItem("token"); const xhr = new XMLHttpRequest(); - console.log(`Attempting a connection to the following endpoint: ${url}`); + console.log("Attempting a connection to the following endpoint: " + url); xhr.open("GET", url, true); xhr.onreadystatechange = function() { if (this.readyState === 4) { if (this.status === 200) { console.log("GET SUCCESS!"); - console.log(`Server response:\n${this.response}`); + console.log("Server response:\n" + this.response); parsedData = JSON.parse(this.response); callback(parsedData); } else { console.error("GET FAILURE!"); - console.error(`Server status: ${this.status}`); - console.error(`Server response:\n${this.response}`); + console.error("Server status: " + this.status); + console.error("Server response:\n" + this.response); } } }; @@ -163,7 +163,7 @@ function createEditReportForm(parsedData) { const reportTitle = parsedData.title; const dateCreated = new Date(parsedData.date_created).toLocaleDateString("en-US"); const h3 = document.createElement("h3"); - h3.innerHTML = `${reportTitle} ${dateCreated}`; + h3.innerHTML = reportTitle + " " + dateCreated; h3.classList.add("text-center"); fragment.appendChild(h3); @@ -189,9 +189,9 @@ function createEditReportForm(parsedData) { for (let key in fields) { let field = fields[key]; - console.log(`Field label: ${field.label}`); - console.log(`Field type: ${field.type}`); - console.log(`Field value: ${field.value}`); + console.log("Field label: " + field.label); + console.log("Field type: " + field.type); + console.log("Field value: " + field.value); // Create a form group for each field and add it to the form let formGroup = createFormGroup(key, field);