@towns-protocol/react-sdk
Version:
React Hooks for Towns Protocol SDK
22 lines • 774 B
JavaScript
'use client';
import { useAction } from './internals/useAction';
import { useSyncAgent } from './useSyncAgent';
/**
* A hook that allows you to create a new direct message (DM).
* @param config - The action config.
* @returns An object containing the `createDM` action and the rest of the action result.
*/
export const useCreateDm = (config) => {
const sync = useSyncAgent();
const { action: createDM, ...rest } = useAction(sync.dms, 'createDM', config);
return {
/**
* Creates a new DM.
* @param userId - The `userId` of the user to create a DM with.
* @returns A promise that resolves to the result of the create operation.
*/
createDM,
...rest,
};
};
//# sourceMappingURL=useCreateDm.js.map