diff --git a/frontend/home/home.css b/frontend/home/home.css new file mode 100644 index 0000000..e69de29 diff --git a/frontend/home/home.html b/frontend/home/home.html new file mode 100644 index 0000000..0cec106 --- /dev/null +++ b/frontend/home/home.html @@ -0,0 +1,11 @@ + + + + + + Temperature-Alarm-Web + + +

hello

+ + \ No newline at end of file diff --git a/frontend/home/home.js b/frontend/home/home.js new file mode 100644 index 0000000..e69de29 diff --git a/frontend/services/devices.service.js b/frontend/services/devices.service.js new file mode 100644 index 0000000..299fe1d --- /dev/null +++ b/frontend/services/devices.service.js @@ -0,0 +1,27 @@ +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)); +} \ No newline at end of file diff --git a/frontend/services/temperature-logs.service.js b/frontend/services/temperature-logs.service.js new file mode 100644 index 0000000..579e852 --- /dev/null +++ b/frontend/services/temperature-logs.service.js @@ -0,0 +1,14 @@ +const address = "http://10.135.51.116/temperature-alarm-webapi/temperature-logs" + +function getOnDeviceIds(ids) { + fetch(`${address}/get-on-device-ids`, { + method: "GET", + 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)); +} \ No newline at end of file diff --git a/frontend/services/users.service.js b/frontend/services/users.service.js new file mode 100644 index 0000000..4b7d530 --- /dev/null +++ b/frontend/services/users.service.js @@ -0,0 +1,40 @@ +const address = "http://10.135.51.116/temperature-alarm-webapi/users" + +function login(username, password) { + fetch(`${address}/login`, { + method: "POST", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify({username: username, password: password}) + }) + .then(response => response.json()) + .then(data => console.log("Success:", data)) + .catch(error => console.error("Error:", error)); +} + +function create(email, username, password){ + fetch(`${address}/create`, { + method: "POST", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify({email: email, username: username, password: password}) + }) + .then(response => response.json()) + .then(data => console.log("Success:", data)) + .catch(error => console.error("Error:", error)); +} + +function update(email, username, password){ + fetch(`${address}/update`, { + method: "PATCH", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify({email: email, username: username, password: password}) + }) + .then(response => response.json()) + .then(data => console.log("Success:", data)) + .catch(error => console.error("Error:", error)); +} \ No newline at end of file