Skip to content
This repository was archived by the owner on Feb 27, 2024. It is now read-only.

Commit 9999cda

Browse files
committed
Set up frontend mutation
1 parent 0e3ae89 commit 9999cda

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

api/frontend/wp/comments/mutationAddComment.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,13 @@ const mutationAddComment = gql`
1111
$postId: Int!
1212
$content: String!
1313
) {
14-
createComment (
15-
input: {
16-
author: $author,
17-
authorEmail: $authorEmail,
18-
authorUrl: $authorUrl,
19-
commentOn: $postId,
20-
content: $content
21-
}
22-
) @rest(type: "Comments", path: "${wpDataEndpoints.comments}?{args}") {
14+
postComment (
15+
author: $author,
16+
authorEmail: $authorEmail,
17+
authorUrl: $authorUrl,
18+
postId: $postId,
19+
content: $content
20+
) @rest(type: "Comments", path: "${wpDataEndpoints.postComment}?{args}") {
2321
comment {
2422
${commentsFields}
2523
}

api/frontend/wp/comments/postComment.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import mutationAddComent from './mutationAddComment'
1+
import mutationAddComment from './mutationAddComment'
22
import {initializeFeApollo} from '../../connector'
33

44
/**
@@ -33,8 +33,8 @@ export default async function postComment(
3333
const apolloClient = initializeFeApollo()
3434

3535
return apolloClient
36-
.query({
37-
query: mutationAddComent,
36+
.mutate({
37+
mutation: mutationAddComment,
3838
variables: {
3939
author,
4040
authorEmail,

0 commit comments

Comments
 (0)