From 19831281e2dbc61072d915082a36cbc4ee242690 Mon Sep 17 00:00:00 2001 From: Johnathan Clementi Date: Wed, 8 Jan 2025 11:02:55 -0500 Subject: [PATCH] Fix label values not updating between edit sessions and update save method #147 --- arches_lingo/src/arches_lingo/api.ts | 20 ++++++ .../components/generic/LabelEditor.vue | 69 +++++++++++++------ .../components/scheme/report/SchemeLabel.vue | 23 +++---- arches_lingo/templates/arches_urls.htm | 1 + arches_lingo/urls.py | 6 ++ arches_lingo/views/api/pythonic_models.py | 5 ++ 6 files changed, 90 insertions(+), 34 deletions(-) diff --git a/arches_lingo/src/arches_lingo/api.ts b/arches_lingo/src/arches_lingo/api.ts index ab9ccd4e..4dc9213c 100644 --- a/arches_lingo/src/arches_lingo/api.ts +++ b/arches_lingo/src/arches_lingo/api.ts @@ -80,6 +80,26 @@ export const fetchSchemeLabel = async (schemeId: string) => { return parsed; }; +export const createSchemeLabel = async ( + schemeId: string, + appellative_status: AppellativeStatus, +) => { + const response = await fetch(arches.urls.api_scheme_label_create, { + method: "POST", + headers: { + "X-CSRFTOKEN": getToken(), + "Content-Type": "application/json", + }, + body: JSON.stringify({ + resourceinstance: schemeId, + ...appellative_status, + }), + }); + const parsed = await response.json(); + if (!response.ok) throw new Error(parsed.message || response.statusText); + return parsed; +}; + export const deleteSchemeLabelTile = async ( schemeId: string, tileId: string, diff --git a/arches_lingo/src/arches_lingo/components/generic/LabelEditor.vue b/arches_lingo/src/arches_lingo/components/generic/LabelEditor.vue index da6f1e0f..82c336f8 100644 --- a/arches_lingo/src/arches_lingo/components/generic/LabelEditor.vue +++ b/arches_lingo/src/arches_lingo/components/generic/LabelEditor.vue @@ -1,12 +1,14 @@