From 9a95f26152a2878985bb52c51514ff0c818506ef Mon Sep 17 00:00:00 2001 From: tonyrewin Date: Tue, 20 Sep 2022 11:26:12 +0300 Subject: [PATCH] queries fixes --- src/components/Topic/Card.tsx | 9 +++++++++ src/graphql/query/article-reactions.ts | 2 +- src/graphql/query/articles-for-author-reactions.ts | 2 +- src/utils/apiClient.ts | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/components/Topic/Card.tsx b/src/components/Topic/Card.tsx index 1bebbb9a..8a95217e 100644 --- a/src/components/Topic/Card.tsx +++ b/src/components/Topic/Card.tsx @@ -73,6 +73,15 @@ export const TopicCard = (props: TopicProps) => { t('author') + plural(topic().stat?.authors || 0, locale() === 'ru' ? ['ов', '', 'а'] : ['s', '', 's'])} + + {topic().stat?.followers + + ' ' + + t('follower') + + plural( + topic().stat?.followers || 0, + locale() === 'ru' ? ['ов', '', 'а'] : ['s', '', 's'] + )} + {/*FIXME*/} {/**/} {/* */} diff --git a/src/graphql/query/article-reactions.ts b/src/graphql/query/article-reactions.ts index 2ddc9602..c04d6bc8 100644 --- a/src/graphql/query/article-reactions.ts +++ b/src/graphql/query/article-reactions.ts @@ -1,7 +1,7 @@ import { gql } from '@urql/core' export default gql` - query ReactionsByShoutQuery($slug: String!, $limit: String!, $limit: Int!, $offset: Int!) { + query ReactionsByShoutQuery($slug: String!, $limit: Int!, $offset: Int!) { reactionsByShout(slug: $slug, limit: $limit, offset: $offset) { id body diff --git a/src/graphql/query/articles-for-author-reactions.ts b/src/graphql/query/articles-for-author-reactions.ts index b96e2834..4592c63e 100644 --- a/src/graphql/query/articles-for-author-reactions.ts +++ b/src/graphql/query/articles-for-author-reactions.ts @@ -3,7 +3,7 @@ import { gql } from '@urql/core' // WARNING: need Auth header export default gql` - query ShoutsReactedByUserQuery($limit: String!, $limit: Int!, $offset: Int!) { + query ShoutsReactedByUserQuery($slug: String!, $limit: Int!, $offset: Int!) { userReactedShouts(slug: String!, page: Int!, size: Int!) { _id: slug title diff --git a/src/utils/apiClient.ts b/src/utils/apiClient.ts index 04ef1418..0c0e8a21 100644 --- a/src/utils/apiClient.ts +++ b/src/utils/apiClient.ts @@ -223,7 +223,7 @@ export const apiClient = { }) .toPromise() - return response.data.reactionsByShout + return response.data.reactionsForShouts }, getArticleReactions: async ({ articleSlug,