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.ts105
1 files changed, 52 insertions, 53 deletions
diff --git a/packages/merchant-backoffice-ui/src/hooks/webhooks.ts b/packages/merchant-backoffice-ui/src/hooks/webhooks.ts
index 4e62a81c9..cc817b84e 100644
--- a/packages/merchant-backoffice-ui/src/hooks/webhooks.ts
+++ b/packages/merchant-backoffice-ui/src/hooks/webhooks.ts
@@ -28,56 +28,56 @@ import { TalerErrorDetail, TalerMerchantApi } from "@gnu-taler/taler-util";
import _useSWR, { SWRHook } from "swr";
const useSWR = _useSWR as unknown as SWRHook;
-export function useWebhookAPI(): WebhookAPI {
- const mutateAll = useMatchMutate();
- const { request } = useBackendInstanceRequest();
-
- const createWebhook = async (
- data: TalerMerchantApi.WebhookAddDetails,
- ): Promise<HttpResponseOk<void>> => {
- const res = await request<void>(`/private/webhooks`, {
- method: "POST",
- data,
- });
- await mutateAll(/.*private\/webhooks.*/);
- return res;
- };
-
- const updateWebhook = async (
- webhookId: string,
- data: TalerMerchantApi.WebhookPatchDetails,
- ): Promise<HttpResponseOk<void>> => {
- const res = await request<void>(`/private/webhooks/${webhookId}`, {
- method: "PATCH",
- data,
- });
- await mutateAll(/.*private\/webhooks.*/);
- return res;
- };
-
- const deleteWebhook = async (
- webhookId: string,
- ): Promise<HttpResponseOk<void>> => {
- const res = await request<void>(`/private/webhooks/${webhookId}`, {
- method: "DELETE",
- });
- await mutateAll(/.*private\/webhooks.*/);
- return res;
- };
-
- return { createWebhook, updateWebhook, deleteWebhook };
-}
-
-export interface WebhookAPI {
- createWebhook: (
- data: TalerMerchantApi.WebhookAddDetails,
- ) => Promise<HttpResponseOk<void>>;
- updateWebhook: (
- id: string,
- data: TalerMerchantApi.WebhookPatchDetails,
- ) => Promise<HttpResponseOk<void>>;
- deleteWebhook: (id: string) => Promise<HttpResponseOk<void>>;
-}
+// export function useWebhookAPI(): WebhookAPI {
+// const mutateAll = useMatchMutate();
+// const { request } = useBackendInstanceRequest();
+
+// const createWebhook = async (
+// data: TalerMerchantApi.WebhookAddDetails,
+// ): Promise<HttpResponseOk<void>> => {
+// const res = await request<void>(`/private/webhooks`, {
+// method: "POST",
+// data,
+// });
+// await mutateAll(/.*private\/webhooks.*/);
+// return res;
+// };
+
+// const updateWebhook = async (
+// webhookId: string,
+// data: TalerMerchantApi.WebhookPatchDetails,
+// ): Promise<HttpResponseOk<void>> => {
+// const res = await request<void>(`/private/webhooks/${webhookId}`, {
+// method: "PATCH",
+// data,
+// });
+// await mutateAll(/.*private\/webhooks.*/);
+// return res;
+// };
+
+// const deleteWebhook = async (
+// webhookId: string,
+// ): Promise<HttpResponseOk<void>> => {
+// const res = await request<void>(`/private/webhooks/${webhookId}`, {
+// method: "DELETE",
+// });
+// await mutateAll(/.*private\/webhooks.*/);
+// return res;
+// };
+
+// return { createWebhook, updateWebhook, deleteWebhook };
+// }
+
+// export interface WebhookAPI {
+// createWebhook: (
+// data: TalerMerchantApi.WebhookAddDetails,
+// ) => Promise<HttpResponseOk<void>>;
+// updateWebhook: (
+// id: string,
+// data: TalerMerchantApi.WebhookPatchDetails,
+// ) => Promise<HttpResponseOk<void>>;
+// deleteWebhook: (id: string) => Promise<HttpResponseOk<void>>;
+// }
export interface InstanceWebhookFilter {
//FIXME: add filter to the webhook list
@@ -133,9 +133,8 @@ export function useInstanceWebhooks(
if (afterData.data.webhooks.length < MAX_RESULT_SIZE) {
setPageAfter(pageAfter + 1);
} else {
- const from = `${
- afterData.data.webhooks[afterData.data.webhooks.length - 1].webhook_id
- }`;
+ const from = `${afterData.data.webhooks[afterData.data.webhooks.length - 1].webhook_id
+ }`;
if (from && updatePosition) updatePosition(from);
}
},