diff --git a/ts/rmo/components/TableReport.vue b/ts/rmo/components/TableReport.vue index 55941d03..68337af2 100644 --- a/ts/rmo/components/TableReport.vue +++ b/ts/rmo/components/TableReport.vue @@ -192,7 +192,6 @@ const formatId = (id: string): string => { * Handle row click event */ const handleRowClick = (report_id: string): void => { - console.log("row clicked", report_id); emit("rowClicked", report_id); }; diff --git a/ts/rmo/store/publicreport.ts b/ts/rmo/store/publicreport.ts index 91bd0d74..9b65f130 100644 --- a/ts/rmo/store/publicreport.ts +++ b/ts/rmo/store/publicreport.ts @@ -11,20 +11,20 @@ import { export const useStorePublicReport = defineStore("publicreport", () => { // State - const _byID = ref>(new Map()); + const _byURI = ref>(new Map()); const loading = ref(false); const ongoingFetches = ref | null>>( new Map(), ); - function add(pr: PublicReport) { - _byID.value.set(pr.public_id, pr); - } + function add(pr: PublicReport) {} async function byID(id: string): Promise { const uri = "/api/rmo/publicreport/" + id; return byURI(uri); } async function byURI(uri: string): Promise { + let result = _byURI.value.get(uri); + if (result) return result; let ongoing = ongoingFetches.value.get(uri); if (ongoing) return ongoing; ongoing = fetchByURI(uri).finally(() => { @@ -41,7 +41,7 @@ export const useStorePublicReport = defineStore("publicreport", () => { data, )) as PublicReportDTO; const result = PublicReport.fromJSON(resp); - _byID.value.set(result.public_id, result); + _byURI.value.set(result.uri, result); return result; } async function fetchByURI(uri: string): Promise { @@ -49,7 +49,7 @@ export const useStorePublicReport = defineStore("publicreport", () => { try { const body = (await apiClient.JSONGet(uri)) as PublicReportDTO; const report = PublicReport.fromJSON(body); - _byID.value.set(report.public_id, report); + _byURI.value.set(report.uri, report); return report; } catch (err) { console.error("Error loading users:", err); @@ -65,7 +65,6 @@ export const useStorePublicReport = defineStore("publicreport", () => { } return { // Actions - add, byID, byURI, createCompliance, diff --git a/ts/rmo/view/StatusByID.vue b/ts/rmo/view/StatusByID.vue index 8b54846b..c9afe5fd 100644 --- a/ts/rmo/view/StatusByID.vue +++ b/ts/rmo/view/StatusByID.vue @@ -146,7 +146,7 @@