Removed all template strings to make IE happy
This commit is contained in:
		
							parent
							
								
									4ae03de53b
								
							
						
					
					
						commit
						04083269ee
					
				
					 3 changed files with 18 additions and 18 deletions
				
			
		|  | @ -13,7 +13,7 @@ function postToLoginEndpoint(event) { | ||||||
|     const url = "https://reqres.in/api/login" // mock api service
 |     const url = "https://reqres.in/api/login" // mock api service
 | ||||||
|     const xhr = new XMLHttpRequest(); |     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.open("POST", url, true); | ||||||
|     xhr.setRequestHeader("Content-Type", "application/json"); |     xhr.setRequestHeader("Content-Type", "application/json"); | ||||||
|  | @ -21,14 +21,14 @@ function postToLoginEndpoint(event) { | ||||||
|         if (this.readyState === 4) { |         if (this.readyState === 4) { | ||||||
|             if (this.status === 200) { |             if (this.status === 200) { | ||||||
|                 console.log("LOGIN SUCCESS!"); |                 console.log("LOGIN SUCCESS!"); | ||||||
|                 console.log(`Server response:\n${this.response}`); |                 console.log("Server response:\n" + this.response); | ||||||
|                 token = JSON.parse(this.response).token; |                 token = JSON.parse(this.response).token; | ||||||
|                 localStorage.setItem("token", token); |                 localStorage.setItem("token", token); | ||||||
|                 window.location.replace("home.html"); |                 window.location.replace("home.html"); | ||||||
|             } else { |             } else { | ||||||
|                 console.error("LOGIN FAILURE!"); |                 console.error("LOGIN FAILURE!"); | ||||||
|                 console.error(`Server status: ${this.status}`); |                 console.error("Server status: " + this.status); | ||||||
|                 console.error(`Server response:\n${this.response}`); |                 console.error("Server response:\n" + this.response); | ||||||
|                 displayErrorMessage(this.response); |                 displayErrorMessage(this.response); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -6,18 +6,18 @@ function postToLogoutEndpoint(event) { | ||||||
|     const xhr = new XMLHttpRequest(); |     const xhr = new XMLHttpRequest(); | ||||||
| 
 | 
 | ||||||
|     xhr.open("POST", url, true); |     xhr.open("POST", url, true); | ||||||
|     xhr.setRequestHeader("Authorization", `Token  ${token}`); |     xhr.setRequestHeader("Authorization", "Token  " + token); | ||||||
|     xhr.onreadystatechange = function() { |     xhr.onreadystatechange = function() { | ||||||
|         if (this.readyState === 4) { |         if (this.readyState === 4) { | ||||||
|             if (this.status === 200) { |             if (this.status === 200) { | ||||||
|                 console.log("LOGOUT SUCCESS!"); |                 console.log("LOGOUT SUCCESS!"); | ||||||
|                 console.log(`Server response:\n${this.response}`); |                 console.log("Server response:\n" + this.response); | ||||||
|                 localStorage.removeItem("token"); |                 localStorage.removeItem("token"); | ||||||
|                 window.location.replace("index.html"); |                 window.location.replace("index.html"); | ||||||
|             } else { |             } else { | ||||||
|                 console.log("LOGOUT FAILURE!"); |                 console.error("LOGOUT FAILURE!"); | ||||||
|                 console.log(`Server status: ${this.status}`); |                 console.error("Server status: " + this.status); | ||||||
|                 console.log(`Server response:\n${this.response}`); |                 console.error("Server response:\n" + this.response); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|  | @ -14,7 +14,7 @@ function getEndpointDomain() { | ||||||
|     else |     else | ||||||
|         OSName = "Unknown OS"; |         OSName = "Unknown OS"; | ||||||
| 
 | 
 | ||||||
|     console.log(`Detected operating system: ${OSName}`); |     console.log("Detected operating system: " + OSName); | ||||||
| 
 | 
 | ||||||
|     if (OSName === "Windows") { |     if (OSName === "Windows") { | ||||||
|         domain = "https://192.168.99.100:8444/"; |         domain = "https://192.168.99.100:8444/"; | ||||||
|  | @ -30,20 +30,20 @@ function getDataFromEndpoint(url, callback) { | ||||||
|     const token = localStorage.getItem("token"); |     const token = localStorage.getItem("token"); | ||||||
|     const xhr = new XMLHttpRequest(); |     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.open("GET", url, true); | ||||||
|     xhr.onreadystatechange = function() { |     xhr.onreadystatechange = function() { | ||||||
|         if (this.readyState === 4) { |         if (this.readyState === 4) { | ||||||
|             if (this.status === 200) { |             if (this.status === 200) { | ||||||
|                 console.log("GET SUCCESS!"); |                 console.log("GET SUCCESS!"); | ||||||
|                 console.log(`Server response:\n${this.response}`); |                 console.log("Server response:\n" + this.response); | ||||||
|                 parsedData = JSON.parse(this.response); |                 parsedData = JSON.parse(this.response); | ||||||
|                 callback(parsedData); |                 callback(parsedData); | ||||||
|             } else { |             } else { | ||||||
|                 console.error("GET FAILURE!"); |                 console.error("GET FAILURE!"); | ||||||
|                 console.error(`Server status: ${this.status}`); |                 console.error("Server status: " + this.status); | ||||||
|                 console.error(`Server response:\n${this.response}`); |                 console.error("Server response:\n" + this.response); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     }; |     }; | ||||||
|  | @ -163,7 +163,7 @@ function createEditReportForm(parsedData) { | ||||||
|     const reportTitle = parsedData.title; |     const reportTitle = parsedData.title; | ||||||
|     const dateCreated = new Date(parsedData.date_created).toLocaleDateString("en-US"); |     const dateCreated = new Date(parsedData.date_created).toLocaleDateString("en-US"); | ||||||
|     const h3 = document.createElement("h3");  |     const h3 = document.createElement("h3");  | ||||||
|     h3.innerHTML = `${reportTitle}  ${dateCreated}`; |     h3.innerHTML = reportTitle + " " + dateCreated; | ||||||
|     h3.classList.add("text-center"); |     h3.classList.add("text-center"); | ||||||
|     fragment.appendChild(h3); |     fragment.appendChild(h3); | ||||||
| 
 | 
 | ||||||
|  | @ -189,9 +189,9 @@ function createEditReportForm(parsedData) { | ||||||
|         for (let key in fields) { |         for (let key in fields) { | ||||||
|             let field = fields[key]; |             let field = fields[key]; | ||||||
| 
 | 
 | ||||||
|             console.log(`Field label: ${field.label}`);  |             console.log("Field label: " + field.label);  | ||||||
|             console.log(`Field type: ${field.type}`);  |             console.log("Field type: " + field.type);  | ||||||
|             console.log(`Field value: ${field.value}`);  |             console.log("Field value: " + field.value);  | ||||||
|              |              | ||||||
|             // Create a form group for each field and add it to the form
 |             // Create a form group for each field and add it to the form
 | ||||||
|             let formGroup = createFormGroup(key, field); |             let formGroup = createFormGroup(key, field); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Preston Doman
						Preston Doman