mirror of
https://github.com/wassname/talk.git
synced 2026-07-11 04:43:15 +08:00
Adding Delete Reaction
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import { graphql } from "react-relay";
|
||||
import { Environment } from "relay-runtime";
|
||||
|
||||
import {
|
||||
commitMutationPromiseNormalized,
|
||||
createMutationContainer,
|
||||
} from "talk-framework/lib/relay";
|
||||
|
||||
import { DeleteCommentReactionMutation as MutationTypes } from "talk-stream/__generated__/DeleteCommentReactionMutation.graphql";
|
||||
import { CreateCommentReactionInput } from "./CreateCommentReactionMutation";
|
||||
|
||||
const mutation = graphql`
|
||||
mutation DeleteCommentReactionMutation($input: CreateCommentReactionInput!) {
|
||||
deleteCommentReaction(input: $input) {
|
||||
comment {
|
||||
id
|
||||
actionCounts {
|
||||
reaction {
|
||||
total
|
||||
}
|
||||
}
|
||||
}
|
||||
clientMutationId
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const clientMutationId = 0;
|
||||
|
||||
function commit(environment: Environment, input: CreateCommentReactionInput) {
|
||||
return commitMutationPromiseNormalized<MutationTypes>(environment, {
|
||||
mutation,
|
||||
variables: {
|
||||
input: {
|
||||
...input,
|
||||
clientMutationId: clientMutationId.toString(),
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export const withDeleteCommentReactionMutation = createMutationContainer(
|
||||
"deleteCommentReaction",
|
||||
commit
|
||||
);
|
||||
|
||||
export type DeleteCommentReactionMutation = (
|
||||
input: CreateCommentReactionInput
|
||||
) => Promise<MutationTypes["response"]["deleteCommentReaction"]>;
|
||||
Reference in New Issue
Block a user