home-topics-one
This commit is contained in:
parent
37bfaec46e
commit
3116af0ec9
|
@ -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 []
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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()
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ export const apiClient = {
|
||||||
})
|
})
|
||||||
.toPromise()
|
.toPromise()
|
||||||
|
|
||||||
return response.data.recentAll
|
return response.data.recentPublished
|
||||||
},
|
},
|
||||||
getArticlesForTopics: async ({
|
getArticlesForTopics: async ({
|
||||||
topicSlugs,
|
topicSlugs,
|
||||||
|
@ -153,15 +153,15 @@ export const apiClient = {
|
||||||
|
|
||||||
// auth
|
// auth
|
||||||
|
|
||||||
signIn: async({ email, password }) => {
|
signIn: async ({ email, password }) => {
|
||||||
const response = await publicGraphQLClient.query(authLogin, { email, password }).toPromise()
|
const response = await publicGraphQLClient.query(authLogin, { email, password }).toPromise()
|
||||||
return response.data.signIn
|
return response.data.signIn
|
||||||
},
|
},
|
||||||
signUp: async({ email, password }) => {
|
signUp: async ({ email, password }) => {
|
||||||
const response = await publicGraphQLClient.query(authRegister, { email, password }).toPromise()
|
const response = await publicGraphQLClient.query(authRegister, { email, password }).toPromise()
|
||||||
return response.data.registerUser
|
return response.data.registerUser
|
||||||
},
|
},
|
||||||
signOut: async() => {
|
signOut: async () => {
|
||||||
const response = await publicGraphQLClient.query(authLogout, {}).toPromise()
|
const response = await publicGraphQLClient.query(authLogout, {}).toPromise()
|
||||||
return response.data.signOut
|
return response.data.signOut
|
||||||
},
|
},
|
||||||
|
@ -170,17 +170,17 @@ export const apiClient = {
|
||||||
const response = await publicGraphQLClient.query(authCheck, { email }).toPromise()
|
const response = await publicGraphQLClient.query(authCheck, { email }).toPromise()
|
||||||
return response.data.isEmailUsed
|
return response.data.isEmailUsed
|
||||||
},
|
},
|
||||||
signReset: async({ email }) => {
|
signReset: async ({ email }) => {
|
||||||
// send reset link with code on email
|
// send reset link with code on email
|
||||||
const response = await publicGraphQLClient.query(authForget, { email }).toPromise()
|
const response = await publicGraphQLClient.query(authForget, { email }).toPromise()
|
||||||
return response.data.reset
|
return response.data.reset
|
||||||
},
|
},
|
||||||
signResend: async({ email }) => {
|
signResend: async ({ email }) => {
|
||||||
// same as reset if code is expired
|
// same as reset if code is expired
|
||||||
const response = await publicGraphQLClient.query(authResend, { email }).toPromise()
|
const response = await publicGraphQLClient.query(authResend, { email }).toPromise()
|
||||||
return response.data.resend
|
return response.data.resend
|
||||||
},
|
},
|
||||||
signResetConfirm: async({ code }) => {
|
signResetConfirm: async ({ code }) => {
|
||||||
// confirm reset password with code
|
// confirm reset password with code
|
||||||
const response = await publicGraphQLClient.query(authReset, { code }).toPromise()
|
const response = await publicGraphQLClient.query(authReset, { code }).toPromise()
|
||||||
return response.data.reset
|
return response.data.reset
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user