mirror of
https://github.com/formbricks/formbricks.git
synced 2026-04-23 22:18:53 -05:00
4636ac9806
* add email notifications settings with notification options on finished responses --------- Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
28 lines
734 B
TypeScript
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();
|
|
};
|