From b707cc0307101357c5fe09039ba318d81d94aa23 Mon Sep 17 00:00:00 2001 From: Barry Gitarts Date: Tue, 20 Aug 2019 14:51:10 -0400 Subject: [PATCH] add getProjects query --- src/components/projects/ListProjects.jsx | 5 ++++- src/components/projects/queries.js | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) 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 + } + } +} +`