Added http to fetch calls

other
Filip Borum Poulsen 1 year ago
parent 554fb7c60e
commit a1b999240a

@ -41,20 +41,20 @@
<button onclick="fetch(`/stopprojector`, { method: 'POST' });">Stop projectors</button>
<h2>Relay 1</h2>
<div id="relay1"></div>
<button onclick="fetch(`10.242.84.111:8080/on/19`);">On relay 1</button>
<button onclick="fetch(`10.242.84.111:8080/off/19`);">Off relay 1</button>
<button onclick="fetch(`http://10.242.84.111:8080/on/19`);">On relay 1</button>
<button onclick="fetch(`http://10.242.84.111:8080/off/19`);">Off relay 1</button>
<h2>Relay 2</h2>
<div id="relay2"></div>
<button onclick="fetch(`10.242.84.111:8080/on/13`);">On relay 2</button>
<button onclick="fetch(`10.242.84.111:8080/off/13`);">Off relay 2</button>
<button onclick="fetch(`http://10.242.84.111:8080/on/13`);">On relay 2</button>
<button onclick="fetch(`http://10.242.84.111:8080/off/13`);">Off relay 2</button>
<h2>Relay 3</h2>
<div id="relay3"></div>
<button onclick="fetch(`10.242.84.111:8080/on/6`);">On relay 3</button>
<button onclick="fetch(`10.242.84.111:8080/off/6`);">Off relay 3</button>
<button onclick="fetch(`http://10.242.84.111:8080/on/6`);">On relay 3</button>
<button onclick="fetch(`http://10.242.84.111:8080/off/6`);">Off relay 3</button>
<h2>Relay 4</h2>
<div id="relay4"></div>
<button onclick="fetch(`10.242.84.111:8080/on/5`);">On relay 4</button>
<button onclick="fetch(`10.242.84.111:8080/off/5`);">Off relay 4</button>
<button onclick="fetch(`http://10.242.84.111:8080/on/5`);">On relay 4</button>
<button onclick="fetch(`http://10.242.84.111:8080/off/5`);">Off relay 4</button>
<script src="/main.js"></script>
</body>
</html>

@ -40,10 +40,10 @@ async function main() {
const relay3Div = document.getElementById('relay3');
const relay4Div = document.getElementById('relay4');
relay1Div.innerText = await (await fetch("10.242.84.111:8080/status/19")).text();
relay2Div.innerText = await (await fetch("10.242.84.111:8080/status/13")).text();
relay3Div.innerText = await (await fetch("10.242.84.111:8080/status/6")).text();
relay4Div.innerText = await (await fetch("10.242.84.111:8080/status/5")).text();
relay1Div.innerText = await (await fetch("http://10.242.84.111:8080/status/19")).text();
relay2Div.innerText = await (await fetch("http://10.242.84.111:8080/status/13")).text();
relay3Div.innerText = await (await fetch("http://10.242.84.111:8080/status/6")).text();
relay4Div.innerText = await (await fetch("http://10.242.84.111:8080/status/5")).text();
}
main();

Loading…
Cancel
Save