parent
7e6ac7583d
commit
5f39251acc
3 changed files with 11 additions and 4 deletions
frontend/src
|
@ -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>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
export default {
|
||||
methods: {
|
||||
notify(payload: any) {
|
||||
// @ts-ignore
|
||||
this.$msgBus.emit('message', payload);
|
||||
},
|
||||
},
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue