channels.ts 654 B

1234567891011121314151617181920212223242526272829303132333435
  1. import gql from 'graphql-tag'
  2. import { videoFieldsFragment } from './videos'
  3. export const channelFieldsFragment = gql`
  4. fragment ChannelFields on Channel {
  5. id
  6. handle
  7. avatarPhotoURL
  8. coverPhotoURL
  9. totalViews
  10. }
  11. `
  12. // TODO: Add proper query params (order, limit, etc.)
  13. export const GET_NEWEST_CHANNELS = gql`
  14. query GetNewestChannels {
  15. channels {
  16. ...ChannelFields
  17. }
  18. }
  19. ${channelFieldsFragment}
  20. `
  21. export const GET_CHANNEL = gql`
  22. query GetChannel($id: ID!) {
  23. channel(id: $id) {
  24. ...ChannelFields
  25. videos {
  26. ...VideoFields
  27. }
  28. }
  29. }
  30. ${channelFieldsFragment}
  31. ${videoFieldsFragment}
  32. `