From 6e64e4f707d74e16e8752882e259a30524b5f164 Mon Sep 17 00:00:00 2001
From: Marc Hanisch <mhanisch@gfz-potsdam.de>
Date: Fri, 5 Mar 2021 11:47:31 +0100
Subject: [PATCH] fixes issue that device copy was not always available

---
 pages/devices/_deviceId/basic/edit.vue | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/pages/devices/_deviceId/basic/edit.vue b/pages/devices/_deviceId/basic/edit.vue
index f1026a82a..4fdf8ba76 100644
--- a/pages/devices/_deviceId/basic/edit.vue
+++ b/pages/devices/_deviceId/basic/edit.vue
@@ -49,7 +49,7 @@
 </template>
 
 <script lang="ts">
-import { Component, Vue, Prop } from 'nuxt-property-decorator'
+import { Component, Vue, Prop, Watch } from 'nuxt-property-decorator'
 
 import DeviceBasicDataForm from '@/components/DeviceBasicDataForm.vue'
 
@@ -101,5 +101,11 @@ export default class DeviceEditBasicPage extends Vue {
   get isLoggedIn () {
     return this.$store.getters['oidc/isAuthenticated']
   }
+
+  @Watch('value', { immediate: true, deep: true })
+  // @ts-ignore
+  onDeviceChanged (val: Device) {
+    this.deviceCopy = Device.createFromObject(val)
+  }
 }
 </script>
-- 
GitLab