1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-26 00:39:41 +02:00
portainer/app/react/docker/services/webhooks/getWebhooks.ts
Chaim Lev-Ari 97d227be2a
fix(swarm/services): convert webhooks API filters to JSON on list request [EE-6621] (#11031)
Co-authored-by: matias-portainer <matias.spinarolli@portainer.io>
2024-01-29 18:08:25 +02:00

24 lines
608 B
TypeScript

import axios, { parseAxiosError } from '@/portainer/services/axios';
import { EnvironmentId } from '@/react/portainer/environments/types';
import { buildUrl } from './build-url';
import { Webhook } from './types';
export async function getWebhooks(
environmentId: EnvironmentId,
serviceId: string
) {
try {
const { data } = await axios.get<Array<Webhook>>(buildUrl(), {
params: {
filters: JSON.stringify({
EndpointID: environmentId,
ResourceID: serviceId,
}),
},
});
return data;
} catch (error) {
throw parseAxiosError(error);
}
}