From 384b960f5d6552526f4daad973e463e2d8b5645e Mon Sep 17 00:00:00 2001 From: Praveen Durairaj Date: Tue, 17 Sep 2019 13:13:04 +0530 Subject: [PATCH] update package versions for next-postgres-graphql (close #2714) (#2894) --- .../sample-apps/nextjs-postgres-graphql/README.md | 10 +++++++--- .../sample-apps/nextjs-postgres-graphql/config.js | 2 +- .../nextjs-postgres-graphql/package.json | 15 +++++++++------ .../nextjs-postgres-graphql/pages/AuthorList.js | 2 +- .../nextjs-postgres-graphql/pages/index.js | 7 +++++-- 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/community/sample-apps/nextjs-postgres-graphql/README.md b/community/sample-apps/nextjs-postgres-graphql/README.md index 8437a505fb7e1..9406a60ce89e6 100644 --- a/community/sample-apps/nextjs-postgres-graphql/README.md +++ b/community/sample-apps/nextjs-postgres-graphql/README.md @@ -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 (
Error..
); + } return (
- +

My Authors

+
); - }} + }} ``` diff --git a/community/sample-apps/nextjs-postgres-graphql/config.js b/community/sample-apps/nextjs-postgres-graphql/config.js index 7a4606c920128..ba92196fb5bce 100644 --- a/community/sample-apps/nextjs-postgres-graphql/config.js +++ b/community/sample-apps/nextjs-postgres-graphql/config.js @@ -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) }) } diff --git a/community/sample-apps/nextjs-postgres-graphql/package.json b/community/sample-apps/nextjs-postgres-graphql/package.json index 23f7c827803e3..a257350a6df5a 100644 --- a/community/sample-apps/nextjs-postgres-graphql/package.json +++ b/community/sample-apps/nextjs-postgres-graphql/package.json @@ -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" } } diff --git a/community/sample-apps/nextjs-postgres-graphql/pages/AuthorList.js b/community/sample-apps/nextjs-postgres-graphql/pages/AuthorList.js index 25c3896ce3f38..508134e895650 100644 --- a/community/sample-apps/nextjs-postgres-graphql/pages/AuthorList.js +++ b/community/sample-apps/nextjs-postgres-graphql/pages/AuthorList.js @@ -1,6 +1,6 @@ const AuthorList = ({ authors }) => (
- {authors.map((a, i) => ( + {authors && authors.map((a, i) => (

{a.name}

diff --git a/community/sample-apps/nextjs-postgres-graphql/pages/index.js b/community/sample-apps/nextjs-postgres-graphql/pages/index.js index 519d05f5df97a..2ee5f63479f52 100644 --- a/community/sample-apps/nextjs-postgres-graphql/pages/index.js +++ b/community/sample-apps/nextjs-postgres-graphql/pages/index.js @@ -19,11 +19,14 @@ const Index = ({ authors } ) => { query={ query } fetchPolicy={ 'cache-and-network' } > - {({ loading, data: { author:authors }}) => { + {({ loading, data, error }) => { + if(error) { + return (
Error..
); + } return (

My Authors

- +
); }}