WebUI reorg (#18)

Reviewed-on: https://code.igox.org/iGoX/busylight/pulls/18
This commit is contained in:
iGoX 2024-12-30 13:11:02 +01:00
parent e7935257e9
commit 4a86e40fa2
3 changed files with 2 additions and 2 deletions

View file

@ -1,70 +0,0 @@
async function setStatus(status = '') {
// Les options par défaut sont indiquées par *
const response = await fetch(`/api/status/${status}`, {
method: "POST", // *GET, POST, PUT, DELETE, etc.
cache: "no-cache", // *default, no-cache, reload, force-cache, only-if-cached
headers: {
"Content-Type": "application/json"
}
});
return response.json(); // transforme la réponse JSON reçue en objet JavaScript natif
}
async function getStatus() {
// Les options par défaut sont indiquées par *
const response = await fetch(`/api/status`, {
method: "GET", // *GET, POST, PUT, DELETE, etc.
cache: "no-cache" // *default, no-cache, reload, force-cache, only-if-cached
});
return response.json(); // transforme la réponse JSON reçue en objet JavaScript natif
}
async function setColor(color = {}) {
// Les options par défaut sont indiquées par *
const response = await fetch(`/api/color`, {
method: "POST", // *GET, POST, PUT, DELETE, etc.
cache: "no-cache", // *default, no-cache, reload, force-cache, only-if-cached
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(color) // le type utilisé pour le corps doit correspondre à l'en-tête "Content-Type"
});
return response.json(); // transforme la réponse JSON reçue en objet JavaScript natif
}
async function getColor() {
// Les options par défaut sont indiquées par *
const response = await fetch(`/api/color`, {
method: "GET", // *GET, POST, PUT, DELETE, etc.
cache: "no-cache", // *default, no-cache, reload, force-cache, only-if-cached
headers: {
"Content-Type": "application/json"
}
});
return response.json(); // transforme la réponse JSON reçue en objet JavaScript natif
}
async function setBrightness(brightness = {}) {
// Les options par défaut sont indiquées par *
const response = await fetch(`/api/brightness`, {
method: "POST", // *GET, POST, PUT, DELETE, etc.
cache: "no-cache", // *default, no-cache, reload, force-cache, only-if-cached
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(brightness) // le type utilisé pour le corps doit correspondre à l'en-tête "Content-Type"
});
return response.json(); // transforme la réponse JSON reçue en objet JavaScript natif
}
async function getBrightness() {
// Les options par défaut sont indiquées par *
const response = await fetch(`/api/brightness`, {
method: "GET", // *GET, POST, PUT, DELETE, etc.
cache: "no-cache", // *default, no-cache, reload, force-cache, only-if-cached
headers: {
"Content-Type": "application/json"
}
});
return response.json(); // transforme la réponse JSON reçue en objet JavaScript natif
}