diff options
author | Sebastian <sebasjm@gmail.com> | 2024-06-03 12:04:31 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2024-06-03 12:12:24 -0300 |
commit | 43857ec597880cbb4d8c6e477fab192b827b962f (patch) | |
tree | 07ee840977dd0232e5ecd1af7745f89edf32741c /packages/merchant-backoffice-ui/src/paths/instance/accounts/update/index.tsx | |
parent | 361a6f9d36542a8ce616b33676e96f769ae34d4d (diff) | |
download | wallet-core-43857ec597880cbb4d8c6e477fab192b827b962f.tar.xz |
fix errors msg and import account letter
Diffstat (limited to 'packages/merchant-backoffice-ui/src/paths/instance/accounts/update/index.tsx')
-rw-r--r-- | packages/merchant-backoffice-ui/src/paths/instance/accounts/update/index.tsx | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/accounts/update/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/accounts/update/index.tsx index 70942fd55..d1a0c9ba4 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/accounts/update/index.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/accounts/update/index.tsx @@ -33,7 +33,7 @@ import { useBankAccountDetails } from "../../../../hooks/bank.js"; import { Notification } from "../../../../utils/types.js"; import { LoginPage } from "../../../login/index.js"; import { NotFoundPageOrAdminCreate } from "../../../notfound/index.js"; -import { TestRevenueErrorType, testRevenueAPI } from "../create/index.js"; +import { testRevenueAPI } from "../create/index.js"; import { UpdatePage } from "./UpdatePage.js"; export type Entity = TalerMerchantApi.AccountPatchDetails & WithId; @@ -89,50 +89,45 @@ export default function UpdateValidator({ revenueAPI, request.credit_facade_credentials, ); + if (resp instanceof TalerError) { + setNotif({ + message: i18n.str`Could not create account`, + type: "ERROR", + description: i18n.str`The request to check the revenue API failed.`, + details: resp.errorDetail + }); + return; + } if (resp.type === "fail") { switch (resp.case) { - case TestRevenueErrorType.NO_CONFIG: { - setNotif({ - message: i18n.str`Could not create account`, - type: "ERROR", - description: i18n.str`The endpoint doesn't seems to be a Taler Revenue API`, - }); - return; - } - case TestRevenueErrorType.CLIENT_BAD_REQUEST: { + case HttpStatusCode.BadRequest: { setNotif({ message: i18n.str`Could not create account`, type: "ERROR", description: i18n.str`Server replied with "bad request".`, }); return; + } - case TestRevenueErrorType.UNAUTHORIZED: { + case HttpStatusCode.Unauthorized: { setNotif({ message: i18n.str`Could not create account`, type: "ERROR", description: i18n.str`Unauthorized, try with another credentials.`, }); return; + } - case TestRevenueErrorType.NOT_FOUND: { - setNotif({ - message: i18n.str`Could not create account`, - type: "ERROR", - description: i18n.str`Check facade URL, server replied with "not found".`, - }); - return; - } - case TestRevenueErrorType.GENERIC_ERROR: { + case HttpStatusCode.NotFound: { setNotif({ message: i18n.str`Could not create account`, type: "ERROR", - description: resp.detail.hint, + description: i18n.str`The endpoint doesn't seems to be a Taler Revenue API`, }); return; } default: { - assertUnreachable(resp.case) + assertUnreachable(resp); } } } |