refactor(ui): use watchers to refresh display
[e-mobility-charging-stations-simulator.git] / ui / web / src / components / actions / SetSupervisionUrl.vue
index 7118cbc68a17544224192db189f0026ba29379d4..887b1d4ce42bee2b0a0dd86e910fc4c455081c76 100644 (file)
@@ -1,7 +1,6 @@
 <template>
-  <h1 id="action">Action</h1>
-  <h2>Set Supervision Url</h2>
-  <h3>Charging Station {{ chargingStationId }}</h3>
+  <h1 id="action">Set Supervision Url</h1>
+  <h2>{{ chargingStationId }}</h2>
   <p>Supervision Url:</p>
   <input
     id="supervision-url"
@@ -15,8 +14,8 @@
     id="action-button"
     @click="
       () => {
-        uiClient
-          .setSupervisionUrl(props.hashId, state.supervisionUrl)
+        $uiClient
+          .setSupervisionUrl(hashId, state.supervisionUrl)
           .then(() => {
             $toast.success('Supervision url successfully set')
           })
 </template>
 
 <script setup lang="ts">
-import { getCurrentInstance, ref } from 'vue'
+import { ref } from 'vue'
 import Button from '@/components/buttons/Button.vue'
 
-const props = defineProps<{
+defineProps<{
   hashId: string
   chargingStationId: string
 }>()
 
-const state = ref({
+const state = ref<{ supervisionUrl: string }>({
   supervisionUrl: ''
 })
-
-const uiClient = getCurrentInstance()?.appContext.config.globalProperties.$uiClient
 </script>
 
 <style>