home-topics-one

This commit is contained in:
tonyrewin 2022-09-09 17:08:17 +03:00
parent 37bfaec46e
commit 3116af0ec9
4 changed files with 16 additions and 20 deletions

View File

@ -56,7 +56,9 @@ export const FeedPage = (props: FeedProps) => {
// TODO: list of articles where you are co-author // TODO: list of articles where you are co-author
// TODO: preload proposals // TODO: preload proposals
// TODO: (maybe?) and changes history // TODO: (maybe?) and changes history
console.debug(reactions().filter((r) => r.kind in AUTHORSHIP_REACTIONS)) // 2 community self-regulating mechanics console.debug(reactions().filter((r) => r.kind in AUTHORSHIP_REACTIONS))
// 2 community self-regulating mechanics
// TODO: query all new posts to be rated for publishing // TODO: query all new posts to be rated for publishing
// TODO: query all reactions where user is in authors list // TODO: query all reactions where user is in authors list
return [] return []

View File

@ -3,11 +3,11 @@ import { FeedPage } from '../../components/Views/Feed'
import Zine from '../../layouts/zine.astro' import Zine from '../../layouts/zine.astro'
import { apiClient } from '../../utils/apiClient' import { apiClient } from '../../utils/apiClient'
const recentArticles = await apiClient.getRecentArticles({ page: 1 }) const recentArticles = await apiClient.getRecentAllArticles({})
const shoutSlugs = recentArticles.map((s) => s.slug) const shoutSlugs = recentArticles.map((s) => s.slug)
const reactions = await apiClient.getReactionsForShouts({ shoutSlugs }) const reactions = await apiClient.getReactionsForShouts({ shoutSlugs })
--- ---
<Zine> <Zine>
<FeedPage articles={recentArticles} reactions={reactions} client:load /> <FeedPage recentArticles={recentArticles} reactions={reactions} client:load />
</Zine> </Zine>

View File

@ -4,7 +4,7 @@ import Zine from '../layouts/zine.astro'
import { apiClient } from '../utils/apiClient' import { apiClient } from '../utils/apiClient'
const randomTopics = await apiClient.getRandomTopics() const randomTopics = await apiClient.getRandomTopics()
const recentPublished = await apiClient.getRecentPublishedArticles() const recentPublished = await apiClient.getRecentPublishedArticles({})
const topMonth = await apiClient.getTopMonthArticles() const topMonth = await apiClient.getTopMonthArticles()
const topOverall = await apiClient.getTopArticles() const topOverall = await apiClient.getTopArticles()

View File

@ -99,7 +99,7 @@ export const apiClient = {
}) })
.toPromise() .toPromise()
return response.data.recentAll return response.data.recentPublished
}, },
getArticlesForTopics: async ({ getArticlesForTopics: async ({
topicSlugs, topicSlugs,
@ -251,23 +251,17 @@ export const apiClient = {
}, },
createReaction: async ({ reaction }) => { createReaction: async ({ reaction }) => {
const response = await privateGraphQLClient const response = await privateGraphQLClient.mutation(reactionCreate, { reaction }).toPromise()
.mutation(reactionCreate, { reaction })
.toPromise()
log.debug('[api] create reaction mutation called') log.debug('[api] create reaction mutation called')
return response.data.createReaction return response.data.createReaction
}, },
updateReaction: async ({ reaction }) => { updateReaction: async ({ reaction }) => {
const response = await privateGraphQLClient const response = await privateGraphQLClient.mutation(reactionUpdate, { reaction }).toPromise()
.mutation(reactionUpdate, { reaction })
.toPromise()
return response.data.createReaction return response.data.createReaction
}, },
destroyReaction: async ({ id }) => { destroyReaction: async ({ id }) => {
const response = await privateGraphQLClient const response = await privateGraphQLClient.mutation(reactionDestroy, { id }).toPromise()
.mutation(reactionDestroy, { id })
.toPromise()
return response.data.deleteReaction return response.data.deleteReaction
} }