From 38d52df46a2c46928bfda98247b8c90d76912d15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Fri, 28 Jul 2023 20:19:12 +0200 Subject: [PATCH] chore, fix: don't create invariants from Selector --- webui/src/util/search.ts | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/webui/src/util/search.ts b/webui/src/util/search.ts index 23b1f91..fca511f 100644 --- a/webui/src/util/search.ts +++ b/webui/src/util/search.ts @@ -24,21 +24,17 @@ export async function createLabelled(label: string) { c: label, }, }; + const [_, entity] = await api.putEntry(body); + return entity; } else { - // TODO - don't create invariants, create UUIDs instead, maybe with keys? - body = { - attribute: ATTR_LABEL, - value: { - t: "String", - c: label, + const [_, entity] = await api.putEntry({ + entity: { + t: "Uuid", }, - }; - } + }); - try { - const [_, entry] = await api.putEntry(body); - return entry; - } catch (error) { - throw new Error(`Failed to create object: ${error}`); + await api.putEntityAttribute(entity, ATTR_LABEL, { t: "String", c: label }); + + return entity; } }