diff --git a/frontend/components/nav.js b/frontend/components/nav.js index 92ac5f2..01f3f3f 100644 --- a/frontend/components/nav.js +++ b/frontend/components/nav.js @@ -5,7 +5,6 @@ import { withApollo } from "../utils/apollo"; const Nav = () => { return ( -
{({ data: { categories } }) => { return ( @@ -39,8 +38,7 @@ const Nav = () => { ); }} -
); }; -export default Nav; \ No newline at end of file +export default Nav \ No newline at end of file diff --git a/frontend/components/query.js b/frontend/components/query.js index c95221a..1b357be 100644 --- a/frontend/components/query.js +++ b/frontend/components/query.js @@ -5,7 +5,11 @@ const Query = ({ children, query, id }) => { variables: {id} }) - if (loading) return

loading...

+ if (loading) return ( +
+

loading...

+
+ ) if (error) return

Error: {JSON.stringify(error)}

return children({ data }) } diff --git a/frontend/next.config.js b/frontend/next.config.js index d1957c2..c20c146 100644 --- a/frontend/next.config.js +++ b/frontend/next.config.js @@ -4,5 +4,8 @@ const withCSS = require('@zeit/next-css') module.exports = withCSS({ env: { API_URL: process.env.API_URL + }, + devIndicators: { + autoPrerender: false, } }) \ No newline at end of file diff --git a/frontend/pages/articles/[id].js b/frontend/pages/articles/[id].js index ba98ab5..7d7d5f6 100644 --- a/frontend/pages/articles/[id].js +++ b/frontend/pages/articles/[id].js @@ -11,10 +11,11 @@ const Article = () => { const router = useRouter(); return ( + {({ data: { article } }) => { return ( - +
-
+ ); }}
+
); }; diff --git a/frontend/pages/categories/[id].js b/frontend/pages/categories/[id].js index 0e6cf4e..c491c75 100644 --- a/frontend/pages/categories/[id].js +++ b/frontend/pages/categories/[id].js @@ -10,10 +10,11 @@ const Category = () => { const router = useRouter(); return ( + <> + {({ data: { category } }) => { return ( -
@@ -22,10 +23,11 @@ const Category = () => {
-
); }}
+
+ ); }; diff --git a/frontend/utils/apollo.js b/frontend/utils/apollo.js index 87128ee..919ef36 100644 --- a/frontend/utils/apollo.js +++ b/frontend/utils/apollo.js @@ -8,20 +8,12 @@ import "../assets/css/style.css"; import Router from 'next/router' -Router.events.on('routeChangeStart', url => NProgress.start()) +Router.events.on('routeChangeStart', () => NProgress.start()) Router.events.on('routeChangeComplete', () => NProgress.done()) Router.events.on('routeChangeError', () => NProgress.done()) const GRAPHQL_URL = process.env.BACKEND_URL || 'http://localhost:1337/graphql' -const link = new HttpLink({ - fetch, - uri: GRAPHQL_URL -}) - - - - let apolloClient = null /**