DRY graphql query with fragments

This is also adding `disabled`, `deleted` flags. I don't know if it
would change anything in the template, but now they are there.
This commit is contained in:
roschaefer 2019-12-20 20:20:47 +01:00
parent f1b581aa86
commit 2bf998d1ba

View File

@ -1,26 +1,23 @@
import gql from 'graphql-tag'
import { userFragment, postFragment } from './Fragments'
export const findResourcesQuery = gql`
${userFragment}
${postFragment}
query($query: String!) {
findResources(query: $query, limit: 5) {
__typename
... on Post {
id
title
slug
...post
commentsCount
shoutedCount
createdAt
author {
id
name
...user
}
}
... on User {
id
name
slug
avatar
...user
}
}
}