Files
formbricks-formbricks/apps/web/lib/responses/responses.ts
T
Johannes 4636ac9806 Add email notification settings (#295)
* add email notifications settings with notification options on finished responses

---------

Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
2023-05-24 17:07:05 +02:00

28 lines
734 B
TypeScript

import { fetcher } from "@formbricks/lib/fetcher";
import useSWR from "swr";
export const useResponses = (environmentId: string, surveyId: string) => {
const { data, error, mutate, isLoading } = useSWR(
`/api/v1/environments/${environmentId}/surveys/${surveyId}/responses`,
fetcher
);
return {
responsesData: data,
isLoadingResponses: isLoading,
isErrorResponses: error,
mutateResponses: mutate,
};
};
export const deleteSubmission = async (environmentId: string, surveyId: string, responseId: string) => {
const response = await fetch(
`/api/v1/environments/${environmentId}/surveys/${surveyId}/responses/${responseId}`,
{
method: "DELETE",
}
);
return response.json();
};