Allow action URIs to be retrieved without errors if they are missing
thingActionUrl may now be told to return `undefined` insstead of throwing an error if the action is missing.
This commit is contained in:
parent
653e1a4159
commit
0b45a5dc76
2 changed files with 3 additions and 2 deletions
|
|
@ -71,12 +71,12 @@ Vue.mixin({
|
|||
}
|
||||
await axios.put(url, value);
|
||||
},
|
||||
thingActionUrl(thing, action) {
|
||||
thingActionUrl(thing, action, allow_missing=false) {
|
||||
let url = this.$store.getters["wot/thingActionUrl"](
|
||||
thing,
|
||||
action,
|
||||
"invokeaction",
|
||||
false
|
||||
allow_missing
|
||||
);
|
||||
return url;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -120,6 +120,7 @@ export const wotStoreModule = {
|
|||
|
||||
export function findFormHref(affordance, op) {
|
||||
// Find the form in the affordance that matches the given operation type
|
||||
if (affordance == undefined) return undefined;
|
||||
let forms = affordance.forms;
|
||||
let matchingForm = forms.find(f => f.op == op || f.op.includes(op));
|
||||
if (matchingForm == undefined) return undefined;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue