From 58323fc496d0fe2a34884b289860264ffd1310e8 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 4 Apr 2024 13:26:46 -0300 Subject: handle not found cases --- .../src/paths/instance/details/index.tsx | 6 +++++- .../src/paths/instance/kyc/list/index.tsx | 10 ++++++++-- .../src/paths/instance/orders/create/index.tsx | 5 ++++- .../src/paths/instance/orders/list/index.tsx | 5 ++++- .../merchant-backoffice-ui/src/paths/instance/token/index.tsx | 6 +++++- .../src/paths/instance/transfers/list/index.tsx | 6 +++++- .../merchant-backoffice-ui/src/paths/instance/update/index.tsx | 6 +++++- 7 files changed, 36 insertions(+), 8 deletions(-) (limited to 'packages/merchant-backoffice-ui') diff --git a/packages/merchant-backoffice-ui/src/paths/instance/details/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/details/index.tsx index 5b6564485..bb1ee944b 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/details/index.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/details/index.tsx @@ -24,6 +24,7 @@ import { useSessionContext } from "../../../context/session.js"; import { useInstanceDetails } from "../../../hooks/instance.js"; import { LoginPage } from "../../login/index.js"; import { DetailPage } from "./DetailPage.js"; +import { NotFoundPageOrAdminCreate } from "../../notfound/index.js"; interface Props { onUpdate: () => void; @@ -50,8 +51,11 @@ export default function Detail({ case HttpStatusCode.Unauthorized: { return } + case HttpStatusCode.NotFound: { + return ; + } default: { - assertUnreachable(result.case) + assertUnreachable(result) } } } diff --git a/packages/merchant-backoffice-ui/src/paths/instance/kyc/list/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/kyc/list/index.tsx index 32c7b6c7f..ed0e1220f 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/kyc/list/index.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/kyc/list/index.tsx @@ -24,7 +24,6 @@ import { VNode, h } from "preact"; import { ErrorLoadingMerchant } from "../../../../components/ErrorLoadingMerchant.js"; import { Loading } from "../../../../components/exception/loading.js"; import { useInstanceKYCDetails } from "../../../../hooks/instance.js"; -import { LoginPage } from "../../../login/index.js"; import { ListPage } from "./ListPage.js"; interface Props { @@ -36,6 +35,10 @@ export default function ListKYC(_p: Props): VNode { if (result instanceof TalerError) { return } + /** + * This component just render known kyc requirements. + * If query fail then is safe to hide errors. + */ if (result.type === "fail") { switch (result.case) { case HttpStatusCode.GatewayTimeout: { @@ -54,7 +57,10 @@ export default function ListKYC(_p: Props): VNode { return
} case HttpStatusCode.Unauthorized: { - return + return
+ } + case HttpStatusCode.NotFound: { + return
; } default: { assertUnreachable(result) diff --git a/packages/merchant-backoffice-ui/src/paths/instance/orders/create/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/orders/create/index.tsx index 10b115905..f612389fe 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/orders/create/index.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/orders/create/index.tsx @@ -61,8 +61,11 @@ export default function OrderCreate({ case HttpStatusCode.Unauthorized: { return } + case HttpStatusCode.NotFound: { + return ; + } default: { - assertUnreachable(detailsResult.case); + assertUnreachable(detailsResult); } } } 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 8efef1c1b..165ced3dc 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 @@ -78,11 +78,14 @@ export default function OrderList({ onCreate, onSelect }: Props): VNode { } if (result.type === "fail") { switch(result.case) { + case HttpStatusCode.NotFound: { + return ; + } case HttpStatusCode.Unauthorized: { return } default: { - assertUnreachable(result.case) + assertUnreachable(result) } } } diff --git a/packages/merchant-backoffice-ui/src/paths/instance/token/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/token/index.tsx index 36ba10e30..768e21325 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/token/index.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/token/index.tsx @@ -25,6 +25,7 @@ import { useInstanceDetails } from "../../../hooks/instance.js"; import { Notification } from "../../../utils/types.js"; import { LoginPage } from "../../login/index.js"; import { DetailPage } from "./DetailPage.js"; +import { NotFoundPageOrAdminCreate } from "../../notfound/index.js"; interface Props { onChange: () => void; @@ -50,8 +51,11 @@ export default function Token({ case HttpStatusCode.Unauthorized: { return } + case HttpStatusCode.NotFound: { + return ; + } default: { - assertUnreachable(result.case) + assertUnreachable(result) } } } diff --git a/packages/merchant-backoffice-ui/src/paths/instance/transfers/list/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/transfers/list/index.tsx index b53f67884..6c451aab8 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/transfers/list/index.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/transfers/list/index.tsx @@ -28,6 +28,7 @@ import { useInstanceBankAccounts } from "../../../../hooks/bank.js"; import { useInstanceTransfers } from "../../../../hooks/transfer.js"; import { LoginPage } from "../../../login/index.js"; import { ListPage } from "./ListPage.js"; +import { NotFoundPageOrAdminCreate } from "../../../notfound/index.js"; interface Props { onCreate: () => void; @@ -79,8 +80,11 @@ export default function ListTransfer({ case HttpStatusCode.Unauthorized: { return } + case HttpStatusCode.NotFound: { + return ; + } default: { - assertUnreachable(result.case); + assertUnreachable(result); } } } diff --git a/packages/merchant-backoffice-ui/src/paths/instance/update/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/update/index.tsx index de3ffce48..b5319bc2d 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/update/index.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/update/index.tsx @@ -31,6 +31,7 @@ import { import { Notification } from "../../../utils/types.js"; import { LoginPage } from "../../login/index.js"; import { UpdatePage } from "./UpdatePage.js"; +import { NotFoundPageOrAdminCreate } from "../../notfound/index.js"; export interface Props { onBack: () => void; @@ -79,8 +80,11 @@ function CommonUpdate( case HttpStatusCode.Unauthorized: { return } + case HttpStatusCode.NotFound: { + return ; + } default: { - assertUnreachable(result.case) + assertUnreachable(result) } } } -- cgit v1.2.3