Skip to main content

Overview

useDeleteSpace returns a callable function for deleting a space. Only space admins can delete a space. Deletion cascades to all entities, members, child spaces, rules, and reports associated with the space.
Deleting a space is permanent. All entities, comments, members, child spaces, and rules belonging to the space are also deleted.

Usage Example

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

function DeleteSpaceButton({ spaceId }: { spaceId: string }) {
  const deleteSpace = useDeleteSpace();

  const handleDelete = async () => {
    if (!confirm("Are you sure? This cannot be undone.")) return;
    await deleteSpace({ spaceId });
  };

  return <button onClick={handleDelete}>Delete Space</button>;
}

Parameters

spaceId
string
required
UUID of the space to delete.

Returns

message
string
Confirmation message.
deletedSpace
object
The id and name of the deleted space.
counts
object
Counts of deleted resources: entities, members, childSpaces.