chore, fix: don't create invariants from Selector

feat/type-attributes
Tomáš Mládek 2023-07-28 20:19:12 +02:00
parent a8f820d68e
commit 38d52df46a
1 changed files with 9 additions and 13 deletions

View File

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