♻️ spaces

This commit is contained in:
Sergey Yarkov 2020-03-02 22:41:26 +03:00
parent aff870be16
commit c5fb489720
12 changed files with 1772 additions and 217 deletions

View File

@ -7,6 +7,6 @@ const ARTICLES_QUERY = gql`
title
}
}
`;
`
export default ARTICLES_QUERY

View File

@ -5,11 +5,13 @@ const Query = ({ children, query, id }) => {
variables: { id }
})
if (loading) return (
if (loading) {
return (
<div className="uk-container">
<p>loading...</p>
</div>
)
}
if (error) return <p>Error: {JSON.stringify(error)}</p>
return children({ data })
}

1556
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -21,5 +21,15 @@
"optimize-css-assets-webpack-plugin": "^5.0.3",
"react": "16.13.0",
"react-dom": "16.13.0"
},
"devDependencies": {
"eslint": "^6.8.0",
"eslint-config-node": "^4.0.0",
"eslint-config-standard-jsx": "^8.1.0",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.18.3",
"eslint-plugin-standard": "^4.0.1"
}
}

View File

@ -17,27 +17,16 @@ const typeDefs = gql`
id: ID
title: String
}
`;
`
const resolvers = {
Query: {
articles: (_parent, _args, _context) => Articles
}
};
const apolloServer = new ApolloServer({
typeDefs,
resolvers
});
const handler = apolloServer.createHandler({
path: "/api/graphql"
});
export const config = {
api: {
bodyParser: false
}
}
const apolloServer = new ApolloServer({ typeDefs, resolvers })
const handler = apolloServer.createHandler({ path: '/api/graphql' })
export const config = { api: { bodyParser: false } }
export default handler

View File

@ -1,9 +1,8 @@
import Layout from '../components/Layout/Layout'
import SEO from '../components/SEO/SEO'
import Query from '../components/Query/query'
import ARTICLES_QUERY from '../apollo/queries/articles/articles';
import { withApollo } from '../lib/apollo';
import ARTICLES_QUERY from '../apollo/queries/articles/articles'
import { withApollo } from '../lib/apollo'
const Articles = () => {
return (
@ -30,7 +29,6 @@ const Articles = () => {
</Layout>
</>
)
}
export default withApollo(Articles)