Files
formbricks-formbricks/apps/web/lib/responseNotes/responsesNotes.ts
2023-06-12 14:37:37 +02:00

22 lines
581 B
TypeScript

export const addResponseNote = async (
environmentId: string,
surveyId: string,
responseId: string,
text: string
) => {
try {
const res = await fetch(
`/api/v1/environments/${environmentId}/surveys/${surveyId}/responses/${responseId}/responsesNotes`,
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(text),
}
);
return await res.json();
} catch (error) {
console.error(error);
throw Error(`createResponseNote: unable to create responseNote: ${error.message}`);
}
};