From 0b45a5dc76e8b3dcfddbe196112cf0a41a78f591 Mon Sep 17 00:00:00 2001 From: Richard Bowman Date: Wed, 17 Jan 2024 13:43:22 +0000 Subject: [PATCH] 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. --- webapp/src/main.js | 4 ++-- webapp/src/wot-client.js | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/webapp/src/main.js b/webapp/src/main.js index 57da92d3..83ee53e2 100644 --- a/webapp/src/main.js +++ b/webapp/src/main.js @@ -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; }, diff --git a/webapp/src/wot-client.js b/webapp/src/wot-client.js index b1aa58d6..94c738a8 100644 --- a/webapp/src/wot-client.js +++ b/webapp/src/wot-client.js @@ -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;