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 { 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user