parent
7e6ac7583d
commit
5f39251acc
3 changed files with 11 additions and 4 deletions
frontend/src
|
@ -28,7 +28,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Optional } from '../../models/Types';
|
import { type Optional } from '../../models/Types';
|
||||||
import Api from '../../mixins/Api.vue';
|
import Api from '../../mixins/Api.vue';
|
||||||
import Loading from '../../elements/Loading.vue';
|
import Loading from '../../elements/Loading.vue';
|
||||||
import Notifications from '../../mixins/Notifications.vue';
|
import Notifications from '../../mixins/Notifications.vue';
|
||||||
|
@ -59,9 +59,15 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
nameElement() {
|
||||||
|
return this.$refs.name as HTMLInputElement;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
async sync() {
|
async sync() {
|
||||||
const name = this.$refs.name.value.trim();
|
const name = this.nameElement.value.trim();
|
||||||
if (!name?.length) {
|
if (!name?.length) {
|
||||||
this.notify({
|
this.notify({
|
||||||
content: 'Please enter a name for your device.',
|
content: 'Please enter a name for your device.',
|
||||||
|
@ -92,7 +98,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
async mounted() {
|
async mounted() {
|
||||||
this.$refs.name.focus();
|
this.nameElement.focus();
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
export default {
|
export default {
|
||||||
methods: {
|
methods: {
|
||||||
notify(payload: any) {
|
notify(payload: any) {
|
||||||
|
// @ts-ignore
|
||||||
this.$msgBus.emit('message', payload);
|
this.$msgBus.emit('message', payload);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -25,7 +25,7 @@ export default {
|
||||||
method: 'PATCH',
|
method: 'PATCH',
|
||||||
body: Object.keys(device).reduce((acc, key) => {
|
body: Object.keys(device).reduce((acc, key) => {
|
||||||
if (!['id', 'userId', 'createdAt', 'updatedAt'].includes(key)) {
|
if (!['id', 'userId', 'createdAt', 'updatedAt'].includes(key)) {
|
||||||
acc[key] = device[key];
|
acc[key] = (device as any)[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
|
|
Loading…
Add table
Reference in a new issue