fix pathing for production
This commit is contained in:
		
							parent
							
								
									5f86de040b
								
							
						
					
					
						commit
						38aad36fc8
					
				| @ -11,7 +11,7 @@ export function androidResultTable(data, creatureName) { | |||||||
|     container.appendChild(creatureTitle) |     container.appendChild(creatureTitle) | ||||||
| 
 | 
 | ||||||
|     let image = document.createElement('img'); |     let image = document.createElement('img'); | ||||||
|     image.src = '/assets/img/android.jpg'; |     image.src = `${window.IMG}/android.jpg`; | ||||||
|     image.onerror = () => { image.src = '/assets/img/404.jpg' }; |     image.onerror = () => { image.src = '/assets/img/404.jpg' }; | ||||||
|     image.style.width = '275px'; |     image.style.width = '275px'; | ||||||
|     image.style.height = '275px'; |     image.style.height = '275px'; | ||||||
|  | |||||||
| @ -24,7 +24,7 @@ document.getElementById('searchForm').addEventListener('submit', function (event | |||||||
|             }) |             }) | ||||||
|             .then((json) => { |             .then((json) => { | ||||||
|                 if (json === null) { // if json is null update the image and stop execution
 |                 if (json === null) { // if json is null update the image and stop execution
 | ||||||
|                     imgElement.src = '/assets/img/404.jpg'; |                     imgElement.src = `${window.IMG}/404.jpg`; | ||||||
|                     throw new Error('No data found'); // this will stop the execution and go to the catch block
 |                     throw new Error('No data found'); // this will stop the execution and go to the catch block
 | ||||||
|                 } |                 } | ||||||
|                 resultSection.innerHTML = ''; // Clear previous content
 |                 resultSection.innerHTML = ''; // Clear previous content
 | ||||||
| @ -37,7 +37,7 @@ document.getElementById('searchForm').addEventListener('submit', function (event | |||||||
|             .catch((err) => { |             .catch((err) => { | ||||||
|                 console.log(err); |                 console.log(err); | ||||||
|                 if (!resultSection.hasChildNodes()) { // Only update the image if it wasn't already updated
 |                 if (!resultSection.hasChildNodes()) { // Only update the image if it wasn't already updated
 | ||||||
|                     imgElement.src = '/assets/img/404.jpg'; |                     imgElement.src = `${window.IMG}/404.jpg`; | ||||||
|                 } |                 } | ||||||
|             }); |             }); | ||||||
|     }, 1000); |     }, 1000); | ||||||
|  | |||||||
| @ -1,13 +1,17 @@ | |||||||
| 
 | 
 | ||||||
| if (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') { | if (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') { | ||||||
|     window.BASE_URL = 'http://127.0.0.1:5000'; |     window.BASE_URL = 'http://127.0.0.1:5000'; | ||||||
|  |     window.IMG = "/assets/img"; | ||||||
|  |     window.CSS = "/assets/css"; | ||||||
|  |     window.JS = "/assets/js"; | ||||||
|  |     window.DOC = "/pages"; | ||||||
| } else { | } else { | ||||||
|     window.BASE_URL = 'https://gammaworld.gmgauthier.com'; |     window.BASE_URL = 'https://gammaworld.gmgauthier.com'; | ||||||
|  |     window.IMG = "/gw/assets/img"; | ||||||
|  |     window.CSS = "/gw/assets/css"; | ||||||
|  |     window.JS = "/gw/assets/js"; | ||||||
|  |     window.DOC = "/gw/pages"; | ||||||
| } | } | ||||||
| window.IMG = "/assets/img"; |  | ||||||
| window.CSS = "/assets/css"; |  | ||||||
| window.JS = "/assets/js"; |  | ||||||
| window.DOC = "/pages"; |  | ||||||
| 
 | 
 | ||||||
| console.log(window.location.hostname) | console.log(window.location.hostname) | ||||||
| console.log(window.BASE_URL) | console.log(window.BASE_URL) | ||||||
| @ -13,7 +13,7 @@ export function setCreatureTable(data, creatureName) { | |||||||
|     creatureId.className = 'creature_id'; |     creatureId.className = 'creature_id'; | ||||||
|     creatureId.innerHTML = ` |     creatureId.innerHTML = ` | ||||||
|                 <h2>${creatureName.toUpperCase()}</h2> |                 <h2>${creatureName.toUpperCase()}</h2> | ||||||
|                 <img src='/assets/img/${creatureName}.jpg' onerror='this.src="/assets/img/404.jpg";' style='width: 275px; height: 275px;'> |                 <img src='${window.IMG}/${creatureName}.jpg' onerror='this.src="${window.IMG}/404.jpg";' style='width: 275px; height: 275px;'> | ||||||
|             `;
 |             `;
 | ||||||
| 
 | 
 | ||||||
|     let profile = createProfileSection(data); |     let profile = createProfileSection(data); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user