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: preload proposals
// 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 reactions where user is in authors list
return []

View File

@ -3,11 +3,11 @@ import { FeedPage } from '../../components/Views/Feed'
import Zine from '../../layouts/zine.astro'
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 reactions = await apiClient.getReactionsForShouts({ shoutSlugs })
---
<Zine>
<FeedPage articles={recentArticles} reactions={reactions} client:load />
<FeedPage recentArticles={recentArticles} reactions={reactions} client:load />
</Zine>

View File

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

View File

@ -99,7 +99,7 @@ export const apiClient = {
})
.toPromise()
return response.data.recentAll
return response.data.recentPublished
},
getArticlesForTopics: async ({
topicSlugs,
@ -153,15 +153,15 @@ export const apiClient = {
// auth
signIn: async({ email, password }) => {
signIn: async ({ email, password }) => {
const response = await publicGraphQLClient.query(authLogin, { email, password }).toPromise()
return response.data.signIn
},
signUp: async({ email, password }) => {
signUp: async ({ email, password }) => {
const response = await publicGraphQLClient.query(authRegister, { email, password }).toPromise()
return response.data.registerUser
},
signOut: async() => {
signOut: async () => {
const response = await publicGraphQLClient.query(authLogout, {}).toPromise()
return response.data.signOut
},
@ -170,17 +170,17 @@ export const apiClient = {
const response = await publicGraphQLClient.query(authCheck, { email }).toPromise()
return response.data.isEmailUsed
},
signReset: async({ email }) => {
signReset: async ({ email }) => {
// send reset link with code on email
const response = await publicGraphQLClient.query(authForget, { email }).toPromise()
return response.data.reset
},
signResend: async({ email }) => {
signResend: async ({ email }) => {
// same as reset if code is expired
const response = await publicGraphQLClient.query(authResend, { email }).toPromise()
return response.data.resend
},
signResetConfirm: async({ code }) => {
signResetConfirm: async ({ code }) => {
// confirm reset password with code
const response = await publicGraphQLClient.query(authReset, { code }).toPromise()
return response.data.reset
@ -251,23 +251,17 @@ export const apiClient = {
},
createReaction: async ({ reaction }) => {
const response = await privateGraphQLClient
.mutation(reactionCreate, { reaction })
.toPromise()
const response = await privateGraphQLClient.mutation(reactionCreate, { reaction }).toPromise()
log.debug('[api] create reaction mutation called')
return response.data.createReaction
},
updateReaction: async ({ reaction }) => {
const response = await privateGraphQLClient
.mutation(reactionUpdate, { reaction })
.toPromise()
const response = await privateGraphQLClient.mutation(reactionUpdate, { reaction }).toPromise()
return response.data.createReaction
},
destroyReaction: async ({ id }) => {
const response = await privateGraphQLClient
.mutation(reactionDestroy, { id })
.toPromise()
const response = await privateGraphQLClient.mutation(reactionDestroy, { id }).toPromise()
return response.data.deleteReaction
}