From 1245c54c6133447858b94420610e9ec4ec17bb7e Mon Sep 17 00:00:00 2001 From: elvoisin <95469923+elvoisin@users.noreply.github.com> Date: Tue, 10 Jun 2025 14:19:31 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F(fix)=20add=20error=20when=20?= =?UTF-8?q?mailbox=20create=20failed=20(#915)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix toast error when mailbox create failed --- CHANGELOG.md | 1 + .../mailboxes/api/useCreateMailbox.tsx | 11 ++++--- .../mailboxes/components/MailBoxesView.tsx | 1 - .../components/ModalCreateMailbox.tsx | 32 ++++++++++++++++++- 4 files changed, 39 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index adaddb6..0cf30c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to ### Added +- ⚡️(fix) add error when mailbox create failed - ✨(mailbox) allow to reset password on mailboxes #834 ## [1.16.0] - 2025-05-05 diff --git a/src/frontend/apps/desk/src/features/mail-domains/mailboxes/api/useCreateMailbox.tsx b/src/frontend/apps/desk/src/features/mail-domains/mailboxes/api/useCreateMailbox.tsx index d9686db..cea8c0d 100644 --- a/src/frontend/apps/desk/src/features/mail-domains/mailboxes/api/useCreateMailbox.tsx +++ b/src/frontend/apps/desk/src/features/mail-domains/mailboxes/api/useCreateMailbox.tsx @@ -26,10 +26,13 @@ export const createMailbox = async ({ }); if (!response.ok) { - throw new APIError( - 'Failed to create the mailbox', - await errorCauses(response), - ); + const errorData = await errorCauses(response); + console.log('Error data:', errorData); + throw new APIError('Failed to create the mailbox', { + status: errorData.status, + cause: errorData.cause as string[], + data: errorData.data, + }); } }; diff --git a/src/frontend/apps/desk/src/features/mail-domains/mailboxes/components/MailBoxesView.tsx b/src/frontend/apps/desk/src/features/mail-domains/mailboxes/components/MailBoxesView.tsx index b3004fe..ada1e4f 100644 --- a/src/frontend/apps/desk/src/features/mail-domains/mailboxes/components/MailBoxesView.tsx +++ b/src/frontend/apps/desk/src/features/mail-domains/mailboxes/components/MailBoxesView.tsx @@ -127,7 +127,6 @@ export function MailBoxesView({ mailDomain }: { mailDomain: MailDomain }) {