Kalyax
2 years ago
4 changed files with 62 additions and 13 deletions
@ -1,5 +0,0 @@ |
|||
import axios from "axios"; |
|||
|
|||
export default async function getTemp(){ |
|||
return await axios.get("/api/temp.php"); |
|||
} |
@ -1,6 +1,31 @@ |
|||
import './style.css'; |
|||
import getTemp from './api_requests.js'; |
|||
getTemp() |
|||
.then((data) => { |
|||
document.getElementById("test").innerHTML = data; |
|||
import axios from 'axios'; |
|||
|
|||
function buttonSwitch(state, button){ |
|||
button.innerText = state = 1 ? "Eteindre" : "Allumer"; |
|||
} |
|||
|
|||
async function getTemp(){ |
|||
return await axios.get("/api/temp.php"); |
|||
} |
|||
|
|||
async function getLightState(light){ |
|||
return await axios.get("/api/light_state.php?l="+light) |
|||
} |
|||
|
|||
async function setLightState(light){ |
|||
const pins = [7, 0, 2, 3, 12, 13, 14, 6]; |
|||
const req = await axios.post("/api/set_light.php", {light: pins[light]}) |
|||
console.log(req.data) |
|||
} |
|||
|
|||
window.setLightState = setLightState |
|||
|
|||
/*getLightState(0).then((data) => { |
|||
const button = document.getElementById("button-radiateur") |
|||
buttonSwitch(data.data, button) |
|||
})*/ |
|||
|
|||
getTemp().then((data) => { |
|||
document.getElementById("temp").innerHTML = data.data; |
|||
}) |
@ -1,3 +1,10 @@ |
|||
@tailwind base; |
|||
@tailwind components; |
|||
@tailwind utilities; |
|||
|
|||
button{ |
|||
@apply bg-slate-400 text-red-400; |
|||
} |
|||
h1{ |
|||
@apply text-3xl bg-yellow-300 font-bold text-emerald-500; |
|||
} |
Loading…
Reference in new issue