reactionsByShout not used
This commit is contained in:
parent
fed39bde86
commit
23c8bba3fd
|
@ -50,7 +50,7 @@ Solid -> Store: loadArticleComments
|
|||
activate Store
|
||||
Store -> apiClient: getArticleComments
|
||||
activate apiClient
|
||||
apiClient -> DB: query: articleReactions
|
||||
apiClient -> DB: query: getReactionsForShouts
|
||||
activate DB
|
||||
DB --> apiClient: response
|
||||
deactivate DB
|
||||
|
|
|
@ -2,8 +2,8 @@ import { ClientOptions, dedupExchange, fetchExchange, createClient, Exchange } f
|
|||
import { devtoolsExchange } from '@urql/devtools'
|
||||
import { isDev } from '../utils/config'
|
||||
|
||||
export const baseUrl = 'https://newapi.discours.io'
|
||||
// export const baseUrl = 'http://localhost:8000'
|
||||
// export const baseUrl = 'https://newapi.discours.io'
|
||||
export const baseUrl = 'http://localhost:8000'
|
||||
|
||||
const exchanges: Exchange[] = [dedupExchange, fetchExchange]
|
||||
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
import { gql } from '@urql/core'
|
||||
|
||||
export default gql`
|
||||
query ReactionsByShoutQuery($slug: String!, $limit: Int!, $offset: Int!) {
|
||||
reactionsByShout(slug: $slug, limit: $limit, offset: $offset) {
|
||||
id
|
||||
body
|
||||
createdAt
|
||||
createdBy {
|
||||
_id: slug
|
||||
name
|
||||
slug
|
||||
userpic
|
||||
}
|
||||
updatedAt
|
||||
replyTo {
|
||||
id
|
||||
}
|
||||
kind
|
||||
range
|
||||
stat {
|
||||
_id: viewed
|
||||
viewed
|
||||
reacted
|
||||
rating
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
|
@ -347,7 +347,6 @@ export type Query = {
|
|||
markdownBody: Scalars['String']
|
||||
myChats: Array<Maybe<ChatResult>>
|
||||
reactionsByAuthor: Array<Maybe<Reaction>>
|
||||
reactionsByShout: Array<Maybe<Reaction>>
|
||||
reactionsForShouts: Array<Maybe<Reaction>>
|
||||
recentAll: Array<Maybe<Shout>>
|
||||
recentCandidates: Array<Maybe<Shout>>
|
||||
|
@ -422,12 +421,6 @@ export type QueryReactionsByAuthorArgs = {
|
|||
slug: Scalars['String']
|
||||
}
|
||||
|
||||
export type QueryReactionsByShoutArgs = {
|
||||
limit: Scalars['Int']
|
||||
offset: Scalars['Int']
|
||||
slug: Scalars['String']
|
||||
}
|
||||
|
||||
export type QueryReactionsForShoutsArgs = {
|
||||
limit: Scalars['Int']
|
||||
offset: Scalars['Int']
|
||||
|
|
|
@ -26,7 +26,7 @@ export const loadArticleReactions = async ({
|
|||
limit?: number
|
||||
offset?: number
|
||||
}): Promise<void> => {
|
||||
const data = await apiClient.getArticleReactions({ articleSlug, limit, offset })
|
||||
const data = await apiClient.getReactionsForShouts({ shoutSlugs: [articleSlug], limit, offset })
|
||||
// TODO: const [data, provider] = roomConnect(articleSlug, username, "reactions")
|
||||
reactionsOrdered.set(data)
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ import type { Reaction, Shout, FollowingEntity, AuthResult } from '../graphql/ty
|
|||
import { publicGraphQLClient } from '../graphql/publicGraphQLClient'
|
||||
import { privateGraphQLClient } from '../graphql/privateGraphQLClient'
|
||||
import articleBySlug from '../graphql/query/article-by-slug'
|
||||
import articleReactions from '../graphql/query/article-reactions'
|
||||
import articlesRecentAll from '../graphql/query/articles-recent-all'
|
||||
import articlesRecentPublished from '../graphql/query/articles-recent-published'
|
||||
import topicsAll from '../graphql/query/topics-all'
|
||||
|
@ -187,13 +186,13 @@ export const apiClient = {
|
|||
limit: number
|
||||
offset?: number
|
||||
}): Promise<Shout[]> => {
|
||||
const response = await publicGraphQLClient
|
||||
.query(articlesForAuthors, {
|
||||
slugs: authorSlugs,
|
||||
limit,
|
||||
offset
|
||||
})
|
||||
.toPromise()
|
||||
const vars = {
|
||||
slugs: authorSlugs,
|
||||
limit,
|
||||
offset
|
||||
}
|
||||
console.debug(vars)
|
||||
const response = await publicGraphQLClient.query(articlesForAuthors, vars).toPromise()
|
||||
|
||||
if (response.error) {
|
||||
console.error('[api-client] getArticlesForAuthors', response.error)
|
||||
|
@ -271,25 +270,6 @@ export const apiClient = {
|
|||
|
||||
return response.data.reactionsForShouts
|
||||
},
|
||||
getArticleReactions: async ({
|
||||
articleSlug,
|
||||
limit = REACTIONS_PAGE_SIZE,
|
||||
offset = 0
|
||||
}: {
|
||||
articleSlug: string
|
||||
limit: number
|
||||
offset: number
|
||||
}): Promise<Reaction[]> => {
|
||||
const response = await publicGraphQLClient
|
||||
.query(articleReactions, {
|
||||
slug: articleSlug,
|
||||
limit,
|
||||
offset
|
||||
})
|
||||
.toPromise()
|
||||
|
||||
return response.data?.reactionsByShout
|
||||
},
|
||||
getAuthorsBySlugs: async ({ slugs }) => {
|
||||
const response = await publicGraphQLClient.query(authorsBySlugs, { slugs }).toPromise()
|
||||
return response.data.getUsersBySlugs
|
||||
|
|
Loading…
Reference in New Issue
Block a user