temperature-alarm/frontend/services/devices.service.js
2025-03-18 10:53:17 +01:00

27 lines
798 B
JavaScript

const address = "http://10.135.51.116/temperature-alarm-webapi/devices"
function getDevicesOnUserId(id) {
fetch(`${address}/get-on-user-id`, {
method: "GET",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({ id: id })
})
.then(response => response.json())
.then(data => console.log("Success:", data))
.catch(error => console.error("Error:", error));
}
function update(ids) {
fetch(`${address}/get-on-user-id`, {
method: "PATCH",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({ ids: ids })
})
.then(response => response.json())
.then(data => console.log("Success:", data))
.catch(error => console.error("Error:", error));
}