Removed all template strings to make IE happy

This commit is contained in:
Preston Doman 2019-02-01 22:24:18 -08:00
parent 4ae03de53b
commit 04083269ee
3 changed files with 18 additions and 18 deletions

View file

@ -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);
}
}

View file

@ -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);
}
}
};

View file

@ -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);