UNPKG

sanity

Version:

Sanity is a real-time content infrastructure with a scalable, hosted backend featuring a Graph Oriented Query Language (GROQ), asset pipelines and fast edge caches

18 lines (14 loc) 432 B
import {type SanityClient} from '@sanity/client' interface RemoveOperationProps { client: SanityClient id: string onRemove?: (id: string) => void } export async function removeOperation(props: RemoveOperationProps): Promise<void> { const {client, id, onRemove} = props onRemove?.(id) await Promise.all([ client.delete({query: `*[_type == "comment" && parentCommentId == "${id}"]`}), client.delete(id), ]) }