mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
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:
parent
f1b581aa86
commit
2bf998d1ba
@ -1,26 +1,23 @@
|
|||||||
import gql from 'graphql-tag'
|
import gql from 'graphql-tag'
|
||||||
|
import { userFragment, postFragment } from './Fragments'
|
||||||
|
|
||||||
export const findResourcesQuery = gql`
|
export const findResourcesQuery = gql`
|
||||||
|
${userFragment}
|
||||||
|
${postFragment}
|
||||||
|
|
||||||
query($query: String!) {
|
query($query: String!) {
|
||||||
findResources(query: $query, limit: 5) {
|
findResources(query: $query, limit: 5) {
|
||||||
__typename
|
__typename
|
||||||
... on Post {
|
... on Post {
|
||||||
id
|
...post
|
||||||
title
|
|
||||||
slug
|
|
||||||
commentsCount
|
commentsCount
|
||||||
shoutedCount
|
shoutedCount
|
||||||
createdAt
|
|
||||||
author {
|
author {
|
||||||
id
|
...user
|
||||||
name
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
... on User {
|
... on User {
|
||||||
id
|
...user
|
||||||
name
|
|
||||||
slug
|
|
||||||
avatar
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user