diff options
Diffstat (limited to 'packages/merchant-backoffice-ui/src/paths/instance/orders/details/index.tsx')
-rw-r--r-- | packages/merchant-backoffice-ui/src/paths/instance/orders/details/index.tsx | 69 |
1 files changed, 41 insertions, 28 deletions
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/orders/details/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/orders/details/index.tsx index dbf1b685a..4633688ba 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/orders/details/index.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/orders/details/index.tsx @@ -32,36 +32,49 @@ export interface Props { onLoadError: (error: HttpError) => VNode; } -export default function Update({ oid, onBack, onLoadError, onNotFound, onUnauthorized }: Props): VNode { +export default function Update({ + oid, + onBack, + onLoadError, + onNotFound, + onUnauthorized, +}: Props): VNode { const { refundOrder } = useOrderAPI(); - const result = useOrderDetails(oid) - const [notif, setNotif] = useState<Notification | undefined>(undefined) + const result = useOrderDetails(oid); + const [notif, setNotif] = useState<Notification | undefined>(undefined); - const i18n = useTranslator() + const i18n = useTranslator(); - if (result.clientError && result.isUnauthorized) return onUnauthorized() - if (result.clientError && result.isNotfound) return onNotFound() - if (result.loading) return <Loading /> - if (!result.ok) return onLoadError(result) + if (result.clientError && result.isUnauthorized) return onUnauthorized(); + if (result.clientError && result.isNotfound) return onNotFound(); + if (result.loading) return <Loading />; + if (!result.ok) return onLoadError(result); - return <Fragment> + return ( + <Fragment> + <NotificationCard notification={notif} /> - <NotificationCard notification={notif} /> - - <DetailPage - onBack={onBack} - id={oid} - onRefund={(id, value) => refundOrder(id, value) - .then(() => setNotif({ - message: i18n`refund created successfully`, - type: "SUCCESS" - })).catch((error) => setNotif({ - message: i18n`could not create the refund`, - type: "ERROR", - description: error.message - })) - } - selected={result.data} - /> - </Fragment> -}
\ No newline at end of file + <DetailPage + onBack={onBack} + id={oid} + onRefund={(id, value) => + refundOrder(id, value) + .then(() => + setNotif({ + message: i18n`refund created successfully`, + type: "SUCCESS", + }), + ) + .catch((error) => + setNotif({ + message: i18n`could not create the refund`, + type: "ERROR", + description: error.message, + }), + ) + } + selected={result.data} + /> + </Fragment> + ); +} |