add getProjects query
This commit is contained in:
parent
444100f5ad
commit
b707cc0307
|
@ -2,10 +2,13 @@ import React from 'react'
|
||||||
import { withStyles } from '@material-ui/core/styles'
|
import { withStyles } from '@material-ui/core/styles'
|
||||||
import Typography from '@material-ui/core/Typography'
|
import Typography from '@material-ui/core/Typography'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
|
import { useQuery } from '@apollo/react-hooks'
|
||||||
import styles from './styles/ListProjects'
|
import styles from './styles/ListProjects'
|
||||||
|
import { getProjects } from './queries'
|
||||||
|
|
||||||
function ListProjects({ classes }) {
|
function ListProjects({ classes }) {
|
||||||
console.log({classes})
|
const { loading, error, data } = useQuery(getProjects);
|
||||||
|
console.log({classes, loading, error, data})
|
||||||
return (
|
return (
|
||||||
<div className={classes.main}>
|
<div className={classes.main}>
|
||||||
<Typography className={classnames(classes.title, classes.fullWidth)}>
|
<Typography className={classnames(classes.title, classes.fullWidth)}>
|
||||||
|
|
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
Loading…
Reference in New Issue