diff --git a/frontend/src/components/devices/DeviceForm.vue b/frontend/src/components/devices/DeviceForm.vue index b771f0f..c2981cd 100644 --- a/frontend/src/components/devices/DeviceForm.vue +++ b/frontend/src/components/devices/DeviceForm.vue @@ -28,7 +28,7 @@ </template> <script lang="ts"> -import { Optional } from '../../models/Types'; +import { type Optional } from '../../models/Types'; import Api from '../../mixins/Api.vue'; import Loading from '../../elements/Loading.vue'; import Notifications from '../../mixins/Notifications.vue'; @@ -59,9 +59,15 @@ export default { } }, + computed: { + nameElement() { + return this.$refs.name as HTMLInputElement; + }, + }, + methods: { async sync() { - const name = this.$refs.name.value.trim(); + const name = this.nameElement.value.trim(); if (!name?.length) { this.notify({ content: 'Please enter a name for your device.', @@ -92,7 +98,7 @@ export default { }, async mounted() { - this.$refs.name.focus(); + this.nameElement.focus(); }, } </script> diff --git a/frontend/src/mixins/Notifications.vue b/frontend/src/mixins/Notifications.vue index 2060db9..3c363fe 100644 --- a/frontend/src/mixins/Notifications.vue +++ b/frontend/src/mixins/Notifications.vue @@ -2,6 +2,7 @@ export default { methods: { notify(payload: any) { + // @ts-ignore this.$msgBus.emit('message', payload); }, }, diff --git a/frontend/src/mixins/api/Devices.vue b/frontend/src/mixins/api/Devices.vue index f138b4d..865076d 100644 --- a/frontend/src/mixins/api/Devices.vue +++ b/frontend/src/mixins/api/Devices.vue @@ -25,7 +25,7 @@ export default { method: 'PATCH', body: Object.keys(device).reduce((acc, key) => { if (!['id', 'userId', 'createdAt', 'updatedAt'].includes(key)) { - acc[key] = device[key]; + acc[key] = (device as any)[key]; } return acc;