From 0935e8cbc7db705f3e78f085de8c366a51891d47 Mon Sep 17 00:00:00 2001 From: smanylov Date: Fri, 29 May 2026 13:05:49 +0700 Subject: [PATCH] fix send appeals --- src/app/actions/fileEntity.ts | 2 +- src/app/components/tanstak-table/TanstakTable.tsx | 1 + src/app/ui/modal-windows/file-appeal-modal-window.tsx | 9 ++++++--- src/i18n/messages/en.json | 3 ++- src/i18n/messages/ru.json | 3 ++- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/app/actions/fileEntity.ts b/src/app/actions/fileEntity.ts index e51fb39..0792a3d 100644 --- a/src/app/actions/fileEntity.ts +++ b/src/app/actions/fileEntity.ts @@ -191,7 +191,7 @@ export async function FileAnAppeal(fileId: string, appealReason: string, additio let parsed = await response.json(); if (parsed.message_code === 0) { - return parsed.message_body; + return parsed; } else { throw parsed; } diff --git a/src/app/components/tanstak-table/TanstakTable.tsx b/src/app/components/tanstak-table/TanstakTable.tsx index 97e522d..d0d24e5 100644 --- a/src/app/components/tanstak-table/TanstakTable.tsx +++ b/src/app/components/tanstak-table/TanstakTable.tsx @@ -709,6 +709,7 @@ export default function TanstakFilesTable({ fileType, showFileLink }: { fileType }; const handleAppeal = async (file: FileItem) => { + console.log(file); setOpenWindowChildren(() => { return ( diff --git a/src/app/ui/modal-windows/file-appeal-modal-window.tsx b/src/app/ui/modal-windows/file-appeal-modal-window.tsx index fd548d0..e0afede 100644 --- a/src/app/ui/modal-windows/file-appeal-modal-window.tsx +++ b/src/app/ui/modal-windows/file-appeal-modal-window.tsx @@ -29,11 +29,14 @@ export function FileAppealModalWindow({ fileId, setWindowClose, setWindowChildre try { const result = await FileAnAppeal(fileId, appealReason, additionalInfo); - if (result && result.status === 'success') { + if (result?.message_desc === 'Appeal submitted successfully') { toast.success(t('appeal-submitted-successfully')); setWindowClose(false); - } else { - toast.error(result?.message || t('appeal-submission-failed')); + } else if (result?.message_desc === 'Active appeal already exists for this file') { + toast.error(t('active-appeal-already-exists-for-this-file')); + } + else { + toast.error(result?.message_desc || t('appeal-submission-failed')); } } catch (error) { console.error('Appeal submission error:', error); diff --git a/src/i18n/messages/en.json b/src/i18n/messages/en.json index 166ebcf..c421875 100644 --- a/src/i18n/messages/en.json +++ b/src/i18n/messages/en.json @@ -492,7 +492,8 @@ "additional-info": "Additional information", "enter-additional-info": "Any additional information that may help...", "submit-appeal": "Submit appeal", - "submitting": "Submitting..." + "submitting": "Submitting...", + "active-appeal-already-exists-for-this-file": "Active appeal already exists for this file" }, "Login-register-form": { "and": "and", diff --git a/src/i18n/messages/ru.json b/src/i18n/messages/ru.json index 35e640b..85fa625 100644 --- a/src/i18n/messages/ru.json +++ b/src/i18n/messages/ru.json @@ -492,7 +492,8 @@ "additional-info": "Дополнительная информация", "enter-additional-info": "Любая дополнительная информация, которая может помочь...", "submit-appeal": "Отправить апелляцию", - "submitting": "Отправка..." + "submitting": "Отправка...", + "active-appeal-already-exists-for-this-file": "По данному делу уже подана активная апелляция" }, "Login-register-form": { "and": "и",