add getProjects query

This commit is contained in:
Barry Gitarts 2019-08-20 14:51:10 -04:00 committed by Barry G
parent 444100f5ad
commit b707cc0307
2 changed files with 23 additions and 1 deletions

View File

@ -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 (
<div className={classes.main}>
<Typography className={classnames(classes.title, classes.fullWidth)}>

View File

@ -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
}
}
}
`