aboutsummaryrefslogtreecommitdiff
path: root/packages/merchant-backoffice-ui/src/hooks/webhooks.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/merchant-backoffice-ui/src/hooks/webhooks.ts')
-rw-r--r--packages/merchant-backoffice-ui/src/hooks/webhooks.ts20
1 files changed, 10 insertions, 10 deletions
diff --git a/packages/merchant-backoffice-ui/src/hooks/webhooks.ts b/packages/merchant-backoffice-ui/src/hooks/webhooks.ts
index e1cd3daf2..9cf6fae03 100644
--- a/packages/merchant-backoffice-ui/src/hooks/webhooks.ts
+++ b/packages/merchant-backoffice-ui/src/hooks/webhooks.ts
@@ -13,17 +13,17 @@
You should have received a copy of the GNU General Public License along with
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-import { MerchantBackend } from "../declaration.js";
-import { useMatchMutate, useBackendInstanceRequest } from "./backend.js";
-import useSWR from "swr";
-import { MAX_RESULT_SIZE, PAGE_SIZE } from "../utils/constants.js";
-import { useEffect, useState } from "preact/hooks";
import {
- HttpError,
HttpResponse,
HttpResponseOk,
HttpResponsePaginated,
+ RequestError,
} from "@gnu-taler/web-util/lib/index.browser";
+import { useEffect, useState } from "preact/hooks";
+import useSWR from "swr";
+import { MerchantBackend } from "../declaration.js";
+import { MAX_RESULT_SIZE, PAGE_SIZE } from "../utils/constants.js";
+import { useBackendInstanceRequest, useMatchMutate } from "./backend.js";
export function useWebhookAPI(): WebhookAPI {
const mutateAll = useMatchMutate();
@@ -100,7 +100,7 @@ export function useInstanceWebhooks(
isValidating: loadingAfter,
} = useSWR<
HttpResponseOk<MerchantBackend.Webhooks.WebhookSummaryResponse>,
- HttpError<MerchantBackend.ErrorDetail>
+ RequestError<MerchantBackend.ErrorDetail>
>([`/private/webhooks`, args?.position, -totalAfter], webhookFetcher);
const [lastAfter, setLastAfter] = useState<
@@ -113,7 +113,7 @@ export function useInstanceWebhooks(
if (afterData) setLastAfter(afterData);
}, [afterData]);
- if (afterError) return afterError;
+ if (afterError) return afterError.info;
const isReachingEnd =
afterData && afterData.data.webhooks.length < totalAfter;
@@ -157,7 +157,7 @@ export function useWebhookDetails(
const { data, error, isValidating } = useSWR<
HttpResponseOk<MerchantBackend.Webhooks.WebhookDetails>,
- HttpError<MerchantBackend.ErrorDetail>
+ RequestError<MerchantBackend.ErrorDetail>
>([`/private/webhooks/${webhookId}`], webhookFetcher, {
refreshInterval: 0,
refreshWhenHidden: false,
@@ -168,6 +168,6 @@ export function useWebhookDetails(
if (isValidating) return { loading: true, data: data?.data };
if (data) return data;
- if (error) return error;
+ if (error) return error.info;
return { loading: true };
}