Download spectrum/shared/graphql/queries/community/getCommunity.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.97 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/shared/graphql/queries/community/getCommunity.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/spectrum/shared/graphql/queries/community/getCommunity.js
-
curl -L -o getCommunity.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/shared/graphql/queries/community/getCommunity.js
1.97 kB
| // @flow | |
| import { graphql } from 'react-apollo'; | |
| import gql from 'graphql-tag'; | |
| import communityInfoFragment from '../../fragments/community/communityInfo'; | |
| import type { CommunityInfoType } from '../../fragments/community/communityInfo'; | |
| import communityMetaDataFragment from '../../fragments/community/communityMetaData'; | |
| import type { CommunityMetaDataType } from '../../fragments/community/communityMetaData'; | |
| export type GetCommunityType = { | |
| ...$Exact<CommunityInfoType>, | |
| ...$Exact<CommunityMetaDataType>, | |
| }; | |
| export const getCommunityByIdQuery = gql` | |
| query getCommunityById($id: ID) { | |
| community(id: $id) { | |
| ...communityInfo | |
| ...communityMetaData | |
| } | |
| } | |
| ${communityInfoFragment} | |
| ${communityMetaDataFragment} | |
| `; | |
| const getCommunityByIdOptions = { | |
| options: ({ id }) => ({ | |
| variables: { | |
| id, | |
| }, | |
| }), | |
| }; | |
| export const getCommunityById = graphql( | |
| getCommunityByIdQuery, | |
| getCommunityByIdOptions | |
| ); | |
| export const getCommunityBySlugQuery = gql` | |
| query getCommunityBySlug($slug: LowercaseString) { | |
| community(slug: $slug) { | |
| ...communityInfo | |
| ...communityMetaData | |
| } | |
| } | |
| ${communityInfoFragment} | |
| ${communityMetaDataFragment} | |
| `; | |
| const getCommunityBySlugOptions = { | |
| options: ({ slug }) => ({ | |
| variables: { | |
| slug: slug, | |
| }, | |
| }), | |
| }; | |
| export const getCommunityBySlug = graphql( | |
| getCommunityBySlugQuery, | |
| getCommunityBySlugOptions | |
| ); | |
| export const getCommunityByMatchQuery = gql` | |
| query getCommunityByMatch($slug: LowercaseString) { | |
| community(slug: $slug) { | |
| ...communityInfo | |
| ...communityMetaData | |
| } | |
| } | |
| ${communityInfoFragment} | |
| ${communityMetaDataFragment} | |
| `; | |
| const getCommunityByMatchOptions = { | |
| options: ({ | |
| match: { | |
| params: { communitySlug }, | |
| }, | |
| }) => ({ | |
| variables: { | |
| slug: communitySlug, | |
| }, | |
| fetchPolicy: 'cache-first', | |
| }), | |
| }; | |
| export const getCommunityByMatch = graphql( | |
| getCommunityByMatchQuery, | |
| getCommunityByMatchOptions | |
| ); | |