UNPKG

@grafana/alerting

Version:

Grafana Alerting Library – Build vertical integrations on top of the industry-leading alerting solution

1 lines 1.13 kB
{"version":3,"file":"createReceiverHandler.mjs","sources":["../../../../../../../../../src/grafana/api/notifications/v0alpha1/mocks/handlers/ReceiverHandlers/createReceiverHandler.ts"],"sourcesContent":["import { HttpResponse, http } from 'msw';\n\nimport { getAPIBaseURLForMocks } from '../../../../../../mocks/util';\nimport { CreateReceiverApiResponse } from '../../../../v0alpha1/notifications.api.gen';\nimport { GROUP, VERSION } from '../../../const';\n\nexport function createReceiverHandler(\n data: CreateReceiverApiResponse | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Response)\n) {\n return http.post(getAPIBaseURLForMocks(GROUP, VERSION, '/receivers'), function handler(info) {\n if (typeof data === 'function') {\n return data(info);\n }\n\n return HttpResponse.json(data);\n });\n}\n"],"names":[],"mappings":";;;;;AAMO,SAAS,sBACd,IAAA,EACA;AACA,EAAA,OAAO,IAAA,CAAK,KAAK,qBAAA,CAAsB,KAAA,EAAO,SAAS,YAAY,CAAA,EAAG,SAAS,OAAA,CAAQ,IAAA,EAAM;AAC3F,IAAA,IAAI,OAAO,SAAS,UAAA,EAAY;AAC9B,MAAA,OAAO,KAAK,IAAI,CAAA;AAAA,IAClB;AAEA,IAAA,OAAO,YAAA,CAAa,KAAK,IAAI,CAAA;AAAA,EAC/B,CAAC,CAAA;AACH;;;;"}