update-reaction-query-fix
This commit is contained in:
parent
2763bb4eef
commit
b295ba0dbf
|
@ -96,7 +96,8 @@ export const Comment = (props: Props) => {
|
|||
const handleUpdate = async (value) => {
|
||||
setLoading(true)
|
||||
try {
|
||||
await updateReaction(props.comment.id, {
|
||||
await updateReaction({
|
||||
id: props.comment.id,
|
||||
kind: ReactionKind.Comment,
|
||||
body: value,
|
||||
shout: props.comment.shout.id,
|
||||
|
|
|
@ -18,7 +18,7 @@ type ReactionsContextType = {
|
|||
offset?: number
|
||||
}) => Promise<Reaction[]>
|
||||
createReaction: (reaction: ReactionInput) => Promise<void>
|
||||
updateReaction: (id: number, reaction: ReactionInput) => Promise<void>
|
||||
updateReaction: (reaction: ReactionInput) => Promise<void>
|
||||
deleteReaction: (id: number) => Promise<void>
|
||||
}
|
||||
|
||||
|
@ -88,8 +88,8 @@ export const ReactionsProvider = (props: { children: JSX.Element }) => {
|
|||
}
|
||||
}
|
||||
|
||||
const updateReaction = async (id: number, input: ReactionInput): Promise<void> => {
|
||||
const reaction = await apiClient.updateReaction(id, input)
|
||||
const updateReaction = async (input: ReactionInput): Promise<void> => {
|
||||
const reaction = await apiClient.updateReaction(input)
|
||||
setReactionEntities(reaction.id, reaction)
|
||||
}
|
||||
|
||||
|
|
|
@ -183,9 +183,9 @@ export const apiClient = {
|
|||
console.debug('[graphql.client.core] destroyReaction:', response)
|
||||
return response.data.delete_reaction.reaction
|
||||
},
|
||||
updateReaction: async (id: number, input: ReactionInput) => {
|
||||
updateReaction: async (reaction: ReactionInput) => {
|
||||
const response = await apiClient.private
|
||||
.mutation(reactionUpdate, { id: id, reaction: input })
|
||||
.mutation(reactionUpdate, { reaction })
|
||||
.toPromise()
|
||||
console.debug('[graphql.client.core] updateReaction:', response)
|
||||
return response.data.update_reaction.reaction
|
||||
|
|
Loading…
Reference in New Issue
Block a user