1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-31 03:09:44 +02:00

refactor(docker/services): convert services table to react [EE-4675] (#10289)

This commit is contained in:
Chaim Lev-Ari 2023-10-22 11:32:05 +02:00 committed by GitHub
parent 6b5c24faff
commit 0dc1805881
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
46 changed files with 969 additions and 850 deletions

View file

@ -0,0 +1,25 @@
import axios, { parseAxiosError } from '@/portainer/services/axios';
import { EnvironmentId } from '@/react/portainer/environments/types';
import { promiseSequence } from '@/portainer/helpers/promise-utils';
import { getWebhooks } from './getWebhooks';
import { Webhook } from './types';
import { buildUrl } from './build-url';
export async function removeWebhooksForService(
environmentId: EnvironmentId,
serviceId: string
) {
const webhooks = await getWebhooks(environmentId, serviceId);
return promiseSequence(
webhooks.map((webhook) => () => removeWebhook(webhook.Id))
);
}
export async function removeWebhook(webhookId: Webhook['Id']) {
try {
await axios.delete(buildUrl(webhookId));
} catch (err) {
throw parseAxiosError(err);
}
}