Skip to content

Commit 7a800c7

Browse files
committed
02-Apollo Client and a GraphQL Query
1 parent fd067ec commit 7a800c7

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/index.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import 'dotenv/config';
22
import 'cross-fetch/polyfill';
3-
import ApolloClient from 'apollo-boost';
3+
import ApolloClient, { gql } from 'apollo-boost';
44

55
const client = new ApolloClient({
66
uri: 'https://api.github.com/graphql',
@@ -12,3 +12,18 @@ const client = new ApolloClient({
1212
});
1313
},
1414
});
15+
16+
const GET_ORGANIZATION = gql`
17+
{
18+
organization(login: "the-road-to-learn-react") {
19+
name
20+
url
21+
}
22+
}
23+
`;
24+
25+
client
26+
.query({
27+
query: GET_ORGANIZATION,
28+
})
29+
.then(console.log);

0 commit comments

Comments
 (0)