Skip to main content

Overview

useModerateSpaceComment returns a callable function for taking moderation action on a comment in a space. Requires the caller to be a moderator or admin.

Usage Example

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

function CommentModerationActions({ spaceId, commentId }: { spaceId: string; commentId: string }) {
  const moderate = useModerateSpaceComment();

  return (
    <div>
      <button onClick={() => moderate({ spaceId, commentId, action: "approve" })}>
        Approve
      </button>
      <button onClick={() => moderate({ spaceId, commentId, action: "remove" })}>
        Remove
      </button>
    </div>
  );
}

Parameters

spaceId
string
required
UUID of the space containing the comment.
commentId
string
required
UUID of the comment to moderate.
action
"approve" | "remove"
required
The moderation action to take.

Returns

A confirmation response from the server. For integration guidance, see Moderation.