merchant-backoffice

ZZZ: Inactive/Deprecated
Log | Files | Refs | Submodules | README

commit b27854f1c3545cde6af4c659c248663d18eab94a
parent a8f51ec0f991bb6ea2b4171c4b3ec50a3dc7ac9b
Author: Sebastian <sebasjm@gmail.com>
Date:   Thu,  2 Dec 2021 15:07:25 -0300

content

Diffstat:
Mpackages/merchant-backoffice/src/InstanceRoutes.tsx | 13+++++++++++--
Mpackages/merchant-backoffice/src/components/menu/index.tsx | 7++++++-
Mpackages/merchant-backoffice/src/utils/types.ts | 1+
3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/packages/merchant-backoffice/src/InstanceRoutes.tsx b/packages/merchant-backoffice/src/InstanceRoutes.tsx @@ -121,16 +121,21 @@ export function InstanceRoutes({ id, admin, setInstanceName }: Props): VNode { [id, token, admin] ); - const ServerErrorRedirectTo = - (to: InstancePaths | AdminPaths) => (error: HttpError) => { + function ServerErrorRedirectTo(to: InstancePaths | AdminPaths) { + return function ServerErrorRedirectToImpl(error: HttpError) { setGlobalNotification({ message: i18n`The backend reported a problem: HTTP status #${error.status}`, description: i18n`Diagnostic from ${error.info?.url} is "${error.message}"`, + details: + error.clientError || error.serverError + ? error.error?.detail + : undefined, type: "ERROR", to, }); return <Redirect to={to} />; }; + } const LoginPageAccessDenied = () => ( <Fragment> @@ -435,6 +440,10 @@ function AdminInstanceUpdatePage({ notification={{ message: i18n`The backend reported a problem: HTTP status #${error.status}`, description: i18n`Diagnostic from ${error.info?.url} is "${error.message}"`, + details: + error.clientError || error.serverError + ? error.error?.detail + : undefined, type: "ERROR", }} /> diff --git a/packages/merchant-backoffice/src/components/menu/index.tsx b/packages/merchant-backoffice/src/components/menu/index.tsx @@ -170,7 +170,12 @@ export function NotificationCard({ <div class="message-header"> <p>{n.message}</p> </div> - {n.description && <div class="message-body">{n.description}</div>} + {n.description && ( + <div class="message-body"> + <div>{n.description}</div> + {n.details && <pre>{n.details}</pre>} + </div> + )} </article> </div> </div> diff --git a/packages/merchant-backoffice/src/utils/types.ts b/packages/merchant-backoffice/src/utils/types.ts @@ -23,6 +23,7 @@ export interface KeyValue { export interface Notification { message: string; description?: string | VNode; + details?: string | VNode; type: MessageType; }