UNPKG

@replyke/core

Version:

Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.

23 lines 840 B
import { useCallback } from "react"; import useProject from "../../projects/useProject"; import useAxiosPrivate from "../../../config/useAxiosPrivate"; function useDeleteRule() { const { projectId } = useProject(); const axios = useAxiosPrivate(); const deleteRule = useCallback(async ({ spaceId, ruleId }) => { if (!projectId) { throw new Error("No projectId available."); } if (!spaceId) { throw new Error("Please pass a spaceId"); } if (!ruleId) { throw new Error("Please pass a ruleId"); } const response = await axios.delete(`/${projectId}/spaces/${spaceId}/rules/${ruleId}`); return response.data; }, [projectId, axios]); return deleteRule; } export default useDeleteRule; //# sourceMappingURL=useDeleteRule.js.map