diff options
Diffstat (limited to 'packages/merchant-backoffice-ui/src/paths/instance')
4 files changed, 22 insertions, 10 deletions
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/orders/details/Detail.stories.tsx b/packages/merchant-backoffice-ui/src/paths/instance/orders/details/Detail.stories.tsx index 6e73a01a5..8b892e122 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/orders/details/Detail.stories.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/orders/details/Detail.stories.tsx @@ -91,7 +91,6 @@ export const PaidNotRefundable = createExample(TestedComponent, { refund_details: [], refund_pending: false, wire_details: [], - wire_reports: [], wired: false, }, }); @@ -115,7 +114,6 @@ export const PaidRefundable = createExample(TestedComponent, { refund_details: [], refund_pending: false, wire_details: [], - wire_reports: [], wired: false, }, }); diff --git a/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/create/CreatedSuccessfully.tsx b/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/create/CreatedSuccessfully.tsx index db3842711..45939c19d 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/create/CreatedSuccessfully.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/create/CreatedSuccessfully.tsx @@ -29,10 +29,6 @@ interface Props { onConfirm: () => void; } -function isNotUndefined<X>(x: X | undefined): x is X { - return !!x; -} - export function CreatedSuccessfully({ entity, onConfirm, diff --git a/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/list/Table.tsx b/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/list/Table.tsx index 0c28027fe..b7c22c17f 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/list/Table.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/list/Table.tsx @@ -161,7 +161,7 @@ function Table({ onClick={(): void => onSelect(i)} style={{ cursor: "pointer" }} > - {i.otp_device_id} + {i.device_description} </td> <td class="is-actions-cell right-sticky"> <div class="buttons is-right"> diff --git a/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/update/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/update/index.tsx index 52f6c6c29..7c7092a4e 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/update/index.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/update/index.tsx @@ -33,6 +33,7 @@ import { Notification } from "../../../../utils/types.js"; import { UpdatePage } from "./UpdatePage.js"; import { HttpStatusCode } from "@gnu-taler/taler-util"; import { useOtpDeviceAPI, useOtpDeviceDetails } from "../../../../hooks/otp.js"; +import { CreatedSuccessfully } from "../create/CreatedSuccessfully.js"; export type Entity = MerchantBackend.OTP.OtpDevicePatchDetails & WithId; @@ -55,6 +56,7 @@ export default function UpdateValidator({ const { updateOtpDevice } = useOtpDeviceAPI(); const result = useOtpDeviceDetails(vid); const [notif, setNotif] = useState<Notification | undefined>(undefined); + const [keyUpdated, setKeyUpdated] = useState<MerchantBackend.OTP.OtpDeviceAddDetails | null>(null) const { i18n } = useTranslationContext(); @@ -73,6 +75,10 @@ export default function UpdateValidator({ return onLoadError(result); } + if (keyUpdated) { + return <CreatedSuccessfully entity={keyUpdated} onConfirm={onConfirm} /> + } + return ( <Fragment> <NotificationCard notification={notif} /> @@ -85,9 +91,21 @@ export default function UpdateValidator({ otp_ctr: result.data.otp_ctr }} onBack={onBack} - onUpdate={(data) => { - return updateOtpDevice(vid, data) - .then(onConfirm) + onUpdate={async (newInfo) => { + return updateOtpDevice(vid, newInfo) + .then((d) => { + if (newInfo.otp_key) { + setKeyUpdated({ + otp_algorithm: newInfo.otp_algorithm, + otp_device_description: newInfo.otp_device_description, + otp_device_id: newInfo.id, + otp_key: newInfo.otp_key, + otp_ctr: newInfo.otp_ctr, + }) + } else { + onConfirm() + } + }) .catch((error) => { setNotif({ message: i18n.str`could not update template`, |