Create, Update, And Delete Reactions
This section covers how to create, update and delete reactions on the Subsocial blockchain.
const substrateApi = await api.substrateApi
Create a reaction
substrateApi.tx.reactions.createPostReaction(postId: AnyPostId, kind: PalletReactionsReactionKind | "Upvote" | "Downvote" | Uint8Array)
Example:
const tx = substrateApi.tx.reactions.createPostReaction('1', 'Upvote')
🆃 ReactionKind: PalletReactionsReactionKind | "Upvote" | "Downvote" | Uint8Array

Update a reaction
Change the type of reaction.
substrateApi.tx.reactions.updatePostReaction(postId: AnyPostId, reactionId: ReactionId, newKind: ReactionType)
Example:
const tx = substrateApi.tx.reactions.updatePostReaction('1', '53', 'Downvote')
🆃 ReactionType: 'Upvote' | 'Downvote'

Delete a reaction
substrateApi.tx.reactions.updatePostReaction(postId: AnyPostId, reactionId: ReactionId)
Example:
const tx = substrateApi.tx.reactions.deletePostReaction('1', '53')
