From 0d5c20d335201c9c9bda382a210503559124d740 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Sun, 27 Jun 2021 00:36:55 +0200 Subject: [PATCH] rename id to addr in AttributeChange types --- ui/src/components/AttributeView.vue | 2 +- ui/src/components/widgets/Table.vue | 4 ++-- ui/src/types/base.ts | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ui/src/components/AttributeView.vue b/ui/src/components/AttributeView.vue index de0612f..6407de3 100644 --- a/ui/src/components/AttributeView.vue +++ b/ui/src/components/AttributeView.vue @@ -72,7 +72,7 @@ export default defineComponent({ }); break; case "delete": - await fetch(`/api/obj/${change.id}`, { method: "DELETE" }); + await fetch(`/api/obj/${change.addr}`, { method: "DELETE" }); break; default: console.error(`Unimplemented: ${change}`); diff --git a/ui/src/components/widgets/Table.vue b/ui/src/components/widgets/Table.vue index 13f607c..6c0b647 100644 --- a/ui/src/components/widgets/Table.vue +++ b/ui/src/components/widgets/Table.vue @@ -90,9 +90,9 @@ export default defineComponent({ this.newEntryAttribute = ""; this.newEntryValue = ""; }, - async removeEntry(id: string) { + async removeEntry(addr: string) { if (confirm("Are you sure you want to remove the attribute?")) { - this.$emit("edit", { type: "delete", id } as AttributeChange); + this.$emit("edit", { type: "delete", addr } as AttributeChange); } }, }, diff --git a/ui/src/types/base.ts b/ui/src/types/base.ts index ba7a0ab..48a4565 100644 --- a/ui/src/types/base.ts +++ b/ui/src/types/base.ts @@ -36,16 +36,16 @@ export type AttributeChange = AttributeCreate | AttributeUpdate | AttributeDelet export interface AttributeCreate { type: "create", attribute: string, - value: string + value: any } export interface AttributeUpdate { type: "update", - id: string, - value: string + addr: string, + value: any } export interface AttributeDelete { type: "delete", - id: string + addr: string } \ No newline at end of file