Skip to content

Commit

Permalink
Update README.md - lastIssues as query name is NOT exported
Browse files Browse the repository at this point in the history
It's 'respository' GraphQL query name is exported/exposed, which we can refer/import from `const { repository } = ...`
  • Loading branch information
alundiak authored Nov 27, 2023
1 parent 15383e0 commit dd332a7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ const { repository } = await graphqlWithAuth(
⚠️ Do not use [template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) in the query strings as they make your code vulnerable to query injection attacks (see [#2](https://github.com/octokit/graphql.js/issues/2)). Use variables instead:

```js
const { lastIssues } = await graphql(
const { repository } = await graphql(
`
query lastIssues($owner: String!, $repo: String!, $num: Int = 3) {
repository(owner: $owner, name: $repo) {
Expand Down Expand Up @@ -168,10 +168,10 @@ const { lastIssues } = await graphql(

```js
const { graphql } = require("@octokit/graphql");
const { lastIssues } = await graphql({
const { repository } = await graphql({
query: `query lastIssues($owner: String!, $repo: String!, $num: Int = 3) {
repository(owner:$owner, name:$repo) {
issues(last:$num) {
repository(owner: $owner, name: $repo) {
issues(last: $num) {
edges {
node {
title
Expand Down

0 comments on commit dd332a7

Please sign in to comment.