Skip to content

Commit

Permalink
update package versions for next-postgres-graphql (close #2714) (#2894)
Browse files Browse the repository at this point in the history
  • Loading branch information
praveenweb authored and shahidhk committed Sep 17, 2019
1 parent b544f75 commit 384b960
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
10 changes: 7 additions & 3 deletions community/sample-apps/nextjs-postgres-graphql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,17 @@ Boilerplate to get started with Nextjs, Hasura GraphQL engine as CMS and postgre
query={ query }
fetchPolicy={ 'cache-and-network' }
>
{({ loading, data: { author:authors }}) => {
{({ loading, data, error }) => {
if(error) {
return (<div>Error..</div>);
}
return (
<div>
<AuthorList authors={authors} />
<h1>My Authors </h1>
<AuthorList authors={data ? data.author: []} />
</div>
);
}}
}}
</Query>
```
Expand Down
2 changes: 1 addition & 1 deletion community/sample-apps/nextjs-postgres-graphql/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { HttpLink } from 'apollo-link-http'

const config = {
link: new HttpLink({
uri: 'https://hasura-graphql-2.herokuapp.com/v1/graphql', // <- Configure GraphQL Server URL (must be absolute)
uri: 'http://localhost:8080/v1/graphql', // <- Configure GraphQL Server URL (must be absolute)
})
}

Expand Down
15 changes: 9 additions & 6 deletions community/sample-apps/nextjs-postgres-graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@
"author": "Karthik V",
"license": "ISC",
"dependencies": {
"graphql-tag": "^2.10.0",
"next": "^7.0.1",
"next-apollo": "^2.0.0",
"react": "^16.5.2",
"react-apollo": "^2.2.4",
"react-dom": "^16.5.2"
"apollo-boost": "^0.4.4",
"graphql": "^14.5.6",
"graphql-tag": "^2.10.1",
"next": "^9.0.5",
"next-apollo": "^3.1.2",
"next-server": "^9.0.5",
"react": "^16.9.0",
"react-apollo": "^3.1.1",
"react-dom": "^16.9.0"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const AuthorList = ({ authors }) => (
<div>
{authors.map((a, i) => (
{authors && authors.map((a, i) => (
<div key={i}>
<h2>{a.name}</h2>
</div>
Expand Down
7 changes: 5 additions & 2 deletions community/sample-apps/nextjs-postgres-graphql/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ const Index = ({ authors } ) => {
query={ query }
fetchPolicy={ 'cache-and-network' }
>
{({ loading, data: { author:authors }}) => {
{({ loading, data, error }) => {
if(error) {
return (<div>Error..</div>);
}
return (
<div>
<h1>My Authors </h1>
<AuthorList authors={authors} />
<AuthorList authors={data ? data.author: []} />
</div>
);
}}
Expand Down

0 comments on commit 384b960

Please sign in to comment.