mirror of
https://github.com/formbricks/formbricks.git
synced 2026-05-03 11:30:50 -05:00
e691c076a1
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Dhruwang Jariwala <67850763+Dhruwang@users.noreply.github.com>
21 lines
620 B
TypeScript
21 lines
620 B
TypeScript
import { TPipelineInput } from "@/app/lib/types/pipelines";
|
|
import { CRON_SECRET, WEBAPP_URL } from "@formbricks/lib/constants";
|
|
|
|
export const sendToPipeline = async ({ event, surveyId, environmentId, response }: TPipelineInput) => {
|
|
return fetch(`${WEBAPP_URL}/api/pipeline`, {
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"x-api-key": CRON_SECRET,
|
|
},
|
|
body: JSON.stringify({
|
|
environmentId: environmentId,
|
|
surveyId: surveyId,
|
|
event,
|
|
response,
|
|
}),
|
|
}).catch((error) => {
|
|
console.error(`Error sending event to pipeline: ${error}`);
|
|
});
|
|
};
|