diff options
author | Sebastian <sebasjm@gmail.com> | 2022-12-19 16:25:09 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-12-19 16:25:09 -0300 |
commit | cf7f819685c19adfe6443a6bdd10f3afe10b247d (patch) | |
tree | 20ace56c90d25a05995dce04432733445646e51e /packages/merchant-backoffice-ui/src/paths/instance/orders | |
parent | 45691dc991945d8c0a3d4bc95078bd1af5932927 (diff) | |
download | wallet-core-cf7f819685c19adfe6443a6bdd10f3afe10b247d.tar.xz |
templates
Diffstat (limited to 'packages/merchant-backoffice-ui/src/paths/instance/orders')
-rw-r--r-- | packages/merchant-backoffice-ui/src/paths/instance/orders/list/index.tsx | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/orders/list/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/orders/list/index.tsx index b5fe7611c..315d78c63 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/orders/list/index.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/orders/list/index.tsx @@ -23,7 +23,7 @@ import { h, VNode, Fragment } from "preact"; import { useState } from "preact/hooks"; import { Loading } from "../../../../components/exception/loading.js"; import { NotificationCard } from "../../../../components/menu/index.js"; -import { MerchantBackend, WithId } from "../../../../declaration.js"; +import { MerchantBackend } from "../../../../declaration.js"; import { HttpError } from "../../../../hooks/backend.js"; import { InstanceOrderFilter, @@ -44,7 +44,7 @@ interface Props { onCreate: () => void; } -export default function ({ +export default function OrderList({ onUnauthorized, onLoadError, onCreate, @@ -56,13 +56,19 @@ export default function ({ MerchantBackend.Orders.OrderHistoryEntry | undefined >(undefined); - const setNewDate = (date?: Date) => setFilter((prev) => ({ ...prev, date })); + const setNewDate = (date?: Date): void => + setFilter((prev) => ({ ...prev, date })); const result = useInstanceOrders(filter, setNewDate); const { refundOrder, getPaymentURL } = useOrderAPI(); const [notif, setNotif] = useState<Notification | undefined>(undefined); + const i18n = useTranslator(); + const [errorOrderId, setErrorOrderId] = useState<string | undefined>( + undefined, + ); + if (result.clientError && result.isUnauthorized) return onUnauthorized(); if (result.clientError && result.isNotfound) return onNotFound(); if (result.loading) return <Loading />; @@ -78,12 +84,7 @@ export default function ({ ? "is-active" : ""; - const i18n = useTranslator(); - const [errorOrderId, setErrorOrderId] = useState<string | undefined>( - undefined, - ); - - async function testIfOrderExistAndSelect(orderId: string) { + async function testIfOrderExistAndSelect(orderId: string): Promise<void> { if (!orderId) { setErrorOrderId(i18n`Enter an order id`); return; @@ -189,7 +190,7 @@ function RefundModalForTable({ onNotFound, onConfirm, onCancel, -}: RefundProps) { +}: RefundProps): VNode { const result = useOrderDetails(id); if (result.clientError && result.isUnauthorized) return onUnauthorized(); @@ -206,6 +207,6 @@ function RefundModalForTable({ ); } -async function copyToClipboard(text: string) { +async function copyToClipboard(text: string): Promise<void> { return navigator.clipboard.writeText(text); } |