From d091971e047ffc816655370b9fd63383d0b760c1 Mon Sep 17 00:00:00 2001 From: Kristina <42462482+Kristina2103@users.noreply.github.com> Date: Tue, 25 Jun 2024 17:17:53 +0200 Subject: [PATCH] Revert "fix: Upload constitution error message based on error status" --- frontend/messages/de.json | 5 ----- frontend/messages/en.json | 5 ----- .../src/components/organisms/Modals/UploadConstitution.tsx | 4 +--- frontend/src/lib/api.ts | 5 ----- 4 files changed, 1 insertion(+), 18 deletions(-) diff --git a/frontend/messages/de.json b/frontend/messages/de.json index 9f1e994d..d6ea5ffc 100644 --- a/frontend/messages/de.json +++ b/frontend/messages/de.json @@ -255,10 +255,5 @@ "Filters": { "sortBy": "Sort by", "clear": "Clear" - }, - "Errors": { - "uploadConstitution": { - "409": "File already exists." - } } } diff --git a/frontend/messages/en.json b/frontend/messages/en.json index 9f1e994d..d6ea5ffc 100644 --- a/frontend/messages/en.json +++ b/frontend/messages/en.json @@ -255,10 +255,5 @@ "Filters": { "sortBy": "Sort by", "clear": "Clear" - }, - "Errors": { - "uploadConstitution": { - "409": "File already exists." - } } } diff --git a/frontend/src/components/organisms/Modals/UploadConstitution.tsx b/frontend/src/components/organisms/Modals/UploadConstitution.tsx index 4b144801..1df38280 100644 --- a/frontend/src/components/organisms/Modals/UploadConstitution.tsx +++ b/frontend/src/components/organisms/Modals/UploadConstitution.tsx @@ -32,9 +32,7 @@ export const UploadConstitution = () => { addSuccessAlert(t("uploadConstitution.alerts.success")); closeModal(); } catch (error) { - addErrorAlert( - error.message ? error.message : t("uploadConstitution.alerts.error") - ); + addErrorAlert(t("uploadConstitution.alerts.error")); } finally { setSubmitting(false); } diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts index 084de03d..a52d478e 100644 --- a/frontend/src/lib/api.ts +++ b/frontend/src/lib/api.ts @@ -18,7 +18,6 @@ import { GovActionStatus, PreviewReasoningModalState, } from "@/components/organisms"; -import { getTranslations } from "next-intl/server"; const baseURL = process.env.NEXT_PUBLIC_API_URL || "http://localhost:1337"; export async function isTokenExpired(token): Promise { @@ -405,10 +404,6 @@ export async function uploadConstitution(data: FormData) { }); return response.data; } catch (error) { - const t = await getTranslations(); - if (error.res.statusCode === 409) { - throw new Error(t(`Errors.uploadConstitution.${error.res.statusCode}`)); - } throw error; } }