@towns-protocol/react-sdk
Version:
React Hooks for Towns Protocol SDK
42 lines • 1.28 kB
TypeScript
import { type Channel } from '@towns-protocol/sdk';
import { type ActionConfig } from './internals/useAction';
/**
* Hook to redact your own message in a channel stream.
* @example
*
* ### Redact a message
*
* You can use `redact` to redact a message in a stream.
* ```ts
* import { useRedact } from '@towns-protocol/react-sdk'
*
* const { redact } = useRedact(streamId)
* redact({ eventId: messageEventId })
* ```
*
* ### Redact a message reaction
*
* You can also use `redact` to redact a message reaction in a stream.
* ```ts
* import { useRedact } from '@towns-protocol/react-sdk'
*
* const { redact } = useRedact(streamId)
* redact({ eventId: reactionEventId })
* ```
* @param streamId - The id of the stream to redact the message in.
* @param config - Configuration options for the action.
* @returns The `redact` action and its loading state.
*/
export declare const useRedact: (streamId: string, config?: ActionConfig<Channel["redact"]>) => {
data: {
eventId: string;
} | undefined;
error: Error | undefined;
isPending: boolean;
isSuccess: boolean;
isError: boolean;
redact: (eventId: string, reason?: string | undefined) => Promise<{
eventId: string;
}>;
};
//# sourceMappingURL=useRedact.d.ts.map