diff --git a/src/components/projects/ListProjects.jsx b/src/components/projects/ListProjects.jsx index bdd1387..ed60706 100644 --- a/src/components/projects/ListProjects.jsx +++ b/src/components/projects/ListProjects.jsx @@ -2,10 +2,13 @@ import React from 'react' import { withStyles } from '@material-ui/core/styles' import Typography from '@material-ui/core/Typography' import classnames from 'classnames' +import { useQuery } from '@apollo/react-hooks' import styles from './styles/ListProjects' +import { getProjects } from './queries' function ListProjects({ classes }) { - console.log({classes}) + const { loading, error, data } = useQuery(getProjects); + console.log({classes, loading, error, data}) return (
diff --git a/src/components/projects/queries.js b/src/components/projects/queries.js index 402acea..8dd3190 100644 --- a/src/components/projects/queries.js +++ b/src/components/projects/queries.js @@ -35,3 +35,22 @@ query Profile($id: ID!){ } } ` +export const getProjects = gql` +query Projects($type: String! = "PROJECT"){ + profiles(first: 5, where: {type: $type}) { + id + addr + canceled + commitTime + type + url + profileId + projectInfo { + id + title + subtitle + creator + } + } +} +`