@apollo/client#gql JavaScript Examples
The following examples show how to use
@apollo/client#gql.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.js From acy-dex-interface with MIT License | 6 votes |
export function useAllOrdersStats(chainId) {
const query = gql(`{
orderStat(id: "total") {
openSwap
openIncrease
openDecrease
executedSwap
executedIncrease
executedDecrease
cancelledSwap
cancelledIncrease
cancelledDecrease
}
}`)
const [res, setRes] = useState()
useEffect(() => {
getGmxGraphClient(chainId).query({ query }).then(setRes).catch(console.warn)
}, [setRes, query, chainId])
return res ? res.data.orderStat : null
}
Example #2
Source File: Character.jsx From web-frontend with MIT License | 6 votes |
QUERY = gql`
query GetCharactersByName($name: String!) {
characters(page: 1, filter: { name: $name }) {
results {
name
id
}
}
}
`
Example #3
Source File: AuthProvider.js From gatsby-apollo-wpgraphql-jwt-starter with MIT License | 6 votes |
LOGIN_USER = gql`
mutation LoginUser($input: LoginInput!) {
login(input: $input) {
user {
jwtAuthToken
jwtRefreshToken
jwtAuthExpiration
username
nicename
}
}
}
`
Example #4
Source File: Table.js From Simplify-Testing-with-React-Testing-Library with MIT License | 6 votes |
EMPLOYEES = gql`
query GetEmployees {
employees {
id
name
department
title
}
}
`
Example #5
Source File: mutations.js From next-ecommerce with MIT License | 6 votes |
SIGN_IN = gql`
mutation SignInMutation($email: String!, $password: String!) {
signIn(input: { email: $email, password: $password }) {
user {
id
name
email
}
}
}
`
Example #6
Source File: queries.js From malware-detection-frontend with Apache License 2.0 | 6 votes |
Signatures = {
RuleDetails: gql` fragment RuleDetails on Rule {
hasMatch
id
lastMatchDate
name
rawRule
metadata
isDisabled
hostCount
}`,
ExtraRuleDetails: gql` fragment ExtraRuleDetails on Rule {
affectedHosts {
totalCount
}
}` }
Example #7
Source File: FirebaseLoginForm.js From RC4Community with Apache License 2.0 | 6 votes |
UPSERT_USER = gql`
mutation UpsertUser($uid: String!, $email: String!, $displayName: String!, $phoneNumber: String, $photoURL: String ) {
upsertUser(uid: $uid, email: $email, displayName: $displayName, phoneNumber: $phoneNumber, photoURL: $photoURL) {
_id
uid
email
displayName
phoneNumber
photoURL
}
}
`
Example #8
Source File: Queries.js From ucurtmetre with GNU General Public License v3.0 | 6 votes |
GET_CORPORATE_SPONSORS = gql`
query corporateSponsors {
corporateSponsors {
type
name
url
image
}
}
`
Example #9
Source File: Sessions.jsx From Consuming-GraphqL-Apollo with MIT License | 6 votes |
SESSIONS_ATTRIBUTES = gql`
fragment SessionInfo on Session {
id
title
startsAt
day
room
level
speakers {
id
name
}
}
`
Example #10
Source File: fragments.js From stack-underflow with MIT License | 6 votes |
COMMENT_DETAILS = gql`
fragment CommentDetails on Comment {
id
author {
...AuthorDetails
}
body
createdAt
updatedAt
}
${AUTHOR_DETAILS}
`
Example #11
Source File: historical_price_card.js From astroport-lbp-frontend with MIT License | 6 votes |
PRICE_QUERY = gql`
query PriceHistory($contractAddress: String!, $from: Float!, $to: Float!, $interval: Float!) {
asset(token: $contractAddress) {
prices {
history(from: $from, to: $to, interval: $interval) {
timestamp
price
}
}
}
}
`
Example #12
Source File: requests.js From ReactNativeApolloOnlineStore with MIT License | 6 votes |
PRODUCT_FRAGMENT = gql`
fragment ProductFragment on Product {
id
name
price
description
favorite @client
thumb {
id
url
}
}
`
Example #13
Source File: FavoriteButton.js From climatescape.org with MIT License | 6 votes |
AddFavorite = gql`
mutation AddFavorite($recordId: String!) {
insertFavorites(objects: [{ recordId: $recordId }]) {
returning {
id
}
}
}
`
Example #14
Source File: add-data.js From graphql-sample-apps with Apache License 2.0 | 6 votes |
addCollection = gql`
mutation AddCollection($date: DateTime!, $readings: [ReadingRef!]!) {
addCollection(input: [
{
timestamp: $date,
readings: $readings,
}
]) {
collection {
readings {
value
metric { name }
}
}
}
}`
Example #15
Source File: favorites.js From goodhere with MIT License | 6 votes |
GetFavorites = gql`
query GetFavorites($loggedIn: Boolean!, $userId: uuid) {
favorites(where: { userId: { _eq: $userId } }) @include(if: $loggedIn) {
id
recordId
}
favoritesCount {
recordId
count
}
}
`
Example #16
Source File: certificate.mutation.js From horondi_admin with MIT License | 6 votes |
bulkGenerateCertificates = gql`
mutation (
$newCertificates: [GenerateCertificateInput]!
$email: String
$dateStart: Date
) {
generateCertificate(
newCertificates: $newCertificates
email: $email
dateStart: $dateStart
) {
... on Certificates {
certificates {
name
value
dateStart
dateEnd
}
}
}
}
`