Skip to main content

Overview

useUpdateRule returns a callable function for updating a rule’s title or description. Only space admins can update rules.

Usage Example

import { useUpdateRule } from "@replyke/react-js";

function EditRuleForm({ spaceId, ruleId }: { spaceId: string; ruleId: string }) {
  const updateRule = useUpdateRule();

  const handleSave = async (title: string, description: string) => {
    const updated = await updateRule({ spaceId, ruleId, update: { title, description } });
    console.log("Updated:", updated.title);
  };
}

Parameters

spaceId
string
required
UUID of the space.
ruleId
string
required
UUID of the rule to update.
update
object
required
Object containing the fields to update. All fields are optional.

Returns

The updated Rule object.