From 3723afe3b287b1fd121925a8d08003ff9e706258 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Fri, 8 Nov 2024 12:03:28 +0100 Subject: [PATCH] fix(ui): metadata edit call put to post --- .../app/components/Client/CustomFields/CustomFieldForm.tsx | 4 +++- frontend/app/services/CustomFieldService.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/app/components/Client/CustomFields/CustomFieldForm.tsx b/frontend/app/components/Client/CustomFields/CustomFieldForm.tsx index dd76542c9..2b95055fa 100644 --- a/frontend/app/components/Client/CustomFields/CustomFieldForm.tsx +++ b/frontend/app/components/Client/CustomFields/CustomFieldForm.tsx @@ -44,9 +44,11 @@ const CustomFieldForm: React.FC = ({ siteId }) => { } else { toast.error(response.errors[0]); } + }).catch(() => { + toast.error('An error occurred while saving metadata.'); }).finally(() => { setLoading(false); - }); + }) }; return ( diff --git a/frontend/app/services/CustomFieldService.ts b/frontend/app/services/CustomFieldService.ts index 1b85e92ba..a87fe83e5 100644 --- a/frontend/app/services/CustomFieldService.ts +++ b/frontend/app/services/CustomFieldService.ts @@ -18,7 +18,7 @@ export default class CustomFieldService extends BaseService { } async update(projectId: string, instance: any): Promise { - return this.client.put(`/${projectId}/metadata/${instance.index}`, instance) + return this.client.post(`/${projectId}/metadata/${instance.index}`, instance) .then(r => r.json()).then(j => j.data); }