aboutsummaryrefslogtreecommitdiff
path: root/packages/merchant-backoffice-ui/src/paths/instance/orders/list/index.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/merchant-backoffice-ui/src/paths/instance/orders/list/index.tsx')
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/orders/list/index.tsx23
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);
}