Hook to redact any message in a channel if you’re an admin.

Imports

import { useAdminRedact } from '@river-build/react-sdk'

Examples

Redact a message

You can use adminRedact to redact a message in a stream.

import { useAdminRedact } from '@river-build/react-sdk'

const { adminRedact } = useAdminRedact(streamId)
adminRedact({ eventId: messageEventId })

Redact a message reaction

You can also use redact to redact a message reaction in a stream.

import { useRedact } from '@river-build/react-sdk'

const { redact } = useRedact(streamId)
redact({ eventId: reactionEventId })

Definition

function useAdminRedact(
  streamId: string,
  config?: ActionConfig<Channel['adminRedact']>,
): {
    data: {
        eventId: string;
    } | undefined;
    error: Error | undefined;
    isPending: boolean;
    isSuccess: boolean;
    isError: boolean;
    adminRedact: (eventId: string) => Promise<{
        eventId: string;
    }>;
}

Source: useAdminRedact

Parameters

streamId

  • Type: string

The id of the stream to redact the message in.

config

  • Type: ActionConfig<Channel['adminRedact']>
  • Optional

Configuration options for the action.

Return Type

The redact action and its loading state.

{
    data: {
        eventId: string;
    } | undefined;
    error: Error | undefined;
    isPending: boolean;
    isSuccess: boolean;
    isError: boolean;
    adminRedact: (eventId: string) => Promise<{
        eventId: string;
    }>;
}