diff --git a/bundles/org.openhab.ui/web/src/components/model/item-details.vue b/bundles/org.openhab.ui/web/src/components/model/item-details.vue index bb4145c7c..d9b8f6c39 100644 --- a/bundles/org.openhab.ui/web/src/components/model/item-details.vue +++ b/bundles/org.openhab.ui/web/src/components/model/item-details.vue @@ -54,6 +54,7 @@ export default { this.createMode = false this.forceSemantics = false if (this.model.item.created === false) { + this.$set(this, 'editedItem', Object.assign({}, this.model.item)) this.createMode = true if (this.model.item.metadata && this.model.item.metadata.semantics) { this.forceSemantics = true @@ -75,14 +76,15 @@ export default { this.editMode = false // TODO properly validate item - if (!this.model.item.name) return + if (!this.editedItem.name) return - this.$oh.api.put('/rest/items/' + this.model.item.name, this.model.item).then((data) => { + this.$oh.api.put('/rest/items/' + this.editedItem.name, this.editedItem).then((data) => { this.$f7.toast.create({ text: 'Item created', destroyOnClose: true, closeTimeout: 2000 }).open() + this.$set(this.model, 'item', JSON.parse(data)) this.model.item.created = true this.model.item.editable = true this.$emit('item-created', this.model.item) diff --git a/bundles/org.openhab.ui/web/src/js/openhab/auth.js b/bundles/org.openhab.ui/web/src/js/openhab/auth.js index 7d2f7e86c..d9be36834 100644 --- a/bundles/org.openhab.ui/web/src/js/openhab/auth.js +++ b/bundles/org.openhab.ui/web/src/js/openhab/auth.js @@ -85,7 +85,7 @@ export function storeBasicCredentials () { export function setAccessToken (token, api) { accessToken = token - if (!token || !api || requireToken !== undefined) return + if (!token || !api || requireToken !== undefined) return Promise.resolve() // determine whether the token is required for user operations return api.head('/rest/sitemaps').then((resp) => {