-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
162 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,55 @@ | ||
|
||
import gql from "graphql-tag"; | ||
import { client } from "./client"; | ||
export function getAllInfomationUserFollowYour(idUser: string) { | ||
return new Promise(resolve => { | ||
const data = client.query({ | ||
query: gql` | ||
query { | ||
getAllInfomationUserFollowYour( id : "${idUser}"){ | ||
idUser | ||
idUserFollow | ||
userComment { | ||
name | ||
avatarLink | ||
} | ||
articleComment { | ||
idUser | ||
createTime | ||
} | ||
} | ||
} | ||
` | ||
}) | ||
resolve(data) | ||
}) | ||
} | ||
//MUATION | ||
// this is function felp we add comment into a article , | ||
// input : idArticle and content comment ? . Iam not sure :v | ||
export function addComment(input: { idUser: string, idUserFollow: string }) { | ||
return new Promise(resolve => { | ||
const data = client.mutate({ | ||
mutation: gql` | ||
mutation AddCommentIntoArticle($input: CommentInput) { | ||
addCommentIntoArticle(input: $input) { | ||
idUser | ||
idUserFollow | ||
userComment | ||
userComment { | ||
name | ||
avatarLink | ||
} | ||
articleComment { | ||
idUser | ||
createTime | ||
} | ||
} | ||
} | ||
`, | ||
variables: { | ||
input | ||
} | ||
}) | ||
resolve(data); | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import gql from "graphql-tag"; | ||
import { client } from "./client"; | ||
export function getAllInfomationUserFollowYour(idUser) { | ||
return new Promise(resolve => { | ||
const data = client.query({ | ||
query: gql` | ||
query { | ||
getAllInfomationUserFollowYour( id : "${idUser}"){ | ||
idUser | ||
idUserFollow | ||
userFollow { | ||
name | ||
avatarLink | ||
articles { | ||
idArticle | ||
} | ||
} | ||
} | ||
} | ||
` | ||
}) | ||
resolve(data) | ||
}) | ||
} | ||
//MUTATION | ||
// define input => idUser and idUserFollow | ||
export function follow(input: any) { | ||
return new Promise(resolve => { | ||
const data = client.mutate({ | ||
mutation: gql` | ||
mutation Follow($input: FollowInput) { | ||
follow(input: $input) { | ||
idUser | ||
idUserFollow | ||
userFollow { | ||
name | ||
avatarLink | ||
articles { | ||
idArticle | ||
} | ||
} | ||
} | ||
} | ||
`, | ||
variables: { | ||
input | ||
} | ||
}) | ||
resolve(data); | ||
}) | ||
} | ||
export function unFollow(input: any) { | ||
return new Promise(resolve => { | ||
const data = client.mutate({ | ||
mutation: gql` | ||
mutation UnFollow($input: FollowInput) { | ||
unFollow(input: $input) { | ||
idUser | ||
idUserFollow | ||
userFollow { | ||
name | ||
avatarLink | ||
articles { | ||
idArticle | ||
} | ||
} | ||
} | ||
} | ||
`, | ||
variables: { | ||
input | ||
} | ||
}) | ||
resolve(data); | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import gql from "graphql-tag"; | ||
import { client } from "./client"; | ||
//QUERY | ||
export function getAllInfomationUserFollowYour(idUser) { | ||
return new Promise(resolve => { | ||
const data = client.query({ | ||
query: gql` | ||
query { | ||
getAllInfomationUserFollowYour( id : "${idUser}"){ | ||
idUser | ||
idUserFollow | ||
userFollow { | ||
name | ||
avatarLink | ||
articles { | ||
idArticle | ||
} | ||
} | ||
} | ||
} | ||
` | ||
}) | ||
resolve(data) | ||
}) | ||
} | ||
//MUTATION | ||
// hash tag not Mutation | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters