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