From 864a1d2a22580a33b5e928734fd256c2133fb672 Mon Sep 17 00:00:00 2001
From: Paul Oliver <contact@pauloliver.dev>
Date: Sat, 3 Jan 2026 00:26:51 +0000
Subject: Adds camera streaming to frontend

---
 hsm-web/Client/src/INA226.vue | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

(limited to 'hsm-web/Client/src/INA226.vue')

diff --git a/hsm-web/Client/src/INA226.vue b/hsm-web/Client/src/INA226.vue
index bf0141f..a827b0b 100644
--- a/hsm-web/Client/src/INA226.vue
+++ b/hsm-web/Client/src/INA226.vue
@@ -1,41 +1,42 @@
 <template>
-  <h3>Battery Status</h3>
+  <h2>Battery Status</h2>
   <table>
     <tbody>
       <tr>
-        <td>{{ ina226Reading.voltage.toFixed(2) }}V</td>
-        <td>{{ ina226Reading.current.toFixed(2) }}A</td>
-        <td>{{ ina226Reading.power.toFixed(2) }}W</td>
+        <td>{{ fmt(reading.voltage, 'V') }}</td>
+        <td>{{ fmt(reading.current, 'A') }}</td>
+        <td>{{ fmt(reading.power,   'W') }}</td>
       </tr>
     </tbody>
   </table>
 </template>
 
 <script>
-import axios from 'axios'
+import axios  from 'axios'
 import config from './config'
 
 export default {
   data() {
     return {
-      ina226Reading: {
+      reading: {
         voltage: 0,
         current: 0,
-        power: 0
+        power:   0
       }
     }
   },
   mounted() {
-    this.getINA226Reading()
+    this.getReading()
   },
   methods: {
-    getINA226Reading() {
-      axios
-        .get(`${config.api}/ina226`)
-        .then(res => {
-          this.ina226Reading = res.data
-          setTimeout(this.getINA226Reading, 1000)
-        })
+    async getReading() {
+      const res    = await axios.get(config.api + '/ina226')
+      this.reading = res.data
+
+      setTimeout(this.getReading, 1000)
+    },
+    fmt(val, sfx) {
+      return val.toFixed(2) + sfx
     }
   }
 }
-- 
cgit v1.2.1

