UNPKG

@replyke/core

Version:

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

23 lines 855 B
import { useCallback } from "react"; import useProject from "../../projects/useProject"; import useAxiosPrivate from "../../../config/useAxiosPrivate"; function useUpdateRule() { const { projectId } = useProject(); const axios = useAxiosPrivate(); const updateRule = useCallback(async ({ spaceId, ruleId, update }) => { 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.patch(`/${projectId}/spaces/${spaceId}/rules/${ruleId}`, update); return response.data; }, [projectId, axios]); return updateRule; } export default useUpdateRule; //# sourceMappingURL=useUpdateRule.js.map