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:
Richard Bowman 2024-01-17 13:43:22 +00:00
parent 653e1a4159
commit 0b45a5dc76
2 changed files with 3 additions and 2 deletions

View file

@ -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;