sigh. javascript. switching to back-ticks for fetch on index.html
This commit is contained in:
parent
c2b8364b6d
commit
c4411006fe
@ -4,6 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" type="text/css" href="styles.css">
|
||||
<title>Gamma World Gaming Tools</title>
|
||||
<script src="config.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div style="text-align: center">
|
||||
@ -31,14 +32,6 @@
|
||||
<div id="toolPanel"></div>
|
||||
|
||||
<script>
|
||||
if (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') {
|
||||
window.BASE_URL = 'http://127.0.0.1:5000';
|
||||
} else {
|
||||
window.BASE_URL = 'https://gammaworld.gmgauthier.com';
|
||||
}
|
||||
console.log(window.location.hostname)
|
||||
console.log(window.BASE_URL)
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
loadContent("intro.html");
|
||||
|
||||
@ -86,7 +79,7 @@
|
||||
document.getElementById('toolPanel').innerHTML = '';
|
||||
document.getElementById('toolPanel').appendChild(imgElement);
|
||||
|
||||
fetch('${window.BASE_URL}/coinflip')
|
||||
fetch(`${window.BASE_URL}/coinflip`)
|
||||
.then(response => response.text())
|
||||
.then(data => {
|
||||
let imgSrc = 'img/' + data.replace(/\"/g, '') + '.jpg';
|
||||
@ -114,7 +107,7 @@
|
||||
imgElement.style.marginRight = 'auto';
|
||||
resultSection.appendChild(imgElement);
|
||||
|
||||
fetch('${window.BASE_URL}/dice/probability')
|
||||
fetch(`${window.BASE_URL}/dice/probability`)
|
||||
.then((response) => {
|
||||
if (!response.ok) {
|
||||
throw response;
|
||||
|
Loading…
Reference in New Issue
Block a user