Add error checking to mixin thing functions

Now we'll get an error if undefined URLs are about to be fetched.
The error will contain thing and affordance, for debugging.
This commit is contained in:
Richard Bowman 2023-12-01 02:43:17 +00:00
parent ee641f5cd2
commit 0cd8ecd2d5
2 changed files with 39 additions and 11 deletions

View file

@ -45,7 +45,8 @@ Vue.mixin({
let url = this.$store.getters["wot/thingPropertyUrl"](
thing,
property,
"readproperty"
"readproperty",
false
);
try {
let response = await axios.get(url);
@ -59,7 +60,8 @@ Vue.mixin({
let url = this.$store.getters["wot/thingPropertyUrl"](
thing,
property,
"writeproperty"
"writeproperty",
false
);
try {
await axios.put(url, value);
@ -68,11 +70,13 @@ Vue.mixin({
}
},
thingActionUrl(thing, action) {
return this.$store.getters["wot/thingActionUrl"](
let url = this.$store.getters["wot/thingActionUrl"](
thing,
action,
"invokeaction"
"invokeaction",
false
);
return url;
},
modalConfirm: function(modalText) {
var context = this;