resolvers-updates
This commit is contained in:
parent
44af27d7a5
commit
e00086ee70
|
@ -52,7 +52,7 @@ export const Comment = (props: Props) => {
|
|||
actions: { showSnackbar },
|
||||
} = useSnackbar()
|
||||
|
||||
const isCommentAuthor = createMemo(() => props.comment.created_by?.slug === author().slug)
|
||||
const isCommentAuthor = createMemo(() => props.comment.created_by?.slug === author()?.slug)
|
||||
|
||||
const comment = createMemo(() => props.comment)
|
||||
const body = createMemo(() => (comment().body || '').trim())
|
||||
|
|
|
@ -84,7 +84,7 @@ export const TopicCard = (props: TopicProps) => {
|
|||
}
|
||||
|
||||
const title = createMemo(() =>
|
||||
capitalize(lang() == 'en' ? props.topic.slug.replace(/-/, ' ') : props.topic.title || ''),
|
||||
capitalize(lang() == 'en' ? props.topic.slug.replace(/-/g, ' ') : props.topic.title || ''),
|
||||
)
|
||||
|
||||
return (
|
||||
|
|
|
@ -54,7 +54,7 @@ export const TopicBadge = (props: Props) => {
|
|||
/>
|
||||
<a href={`/topic/${props.topic.slug}`} class={styles.info}>
|
||||
<span class={styles.title}>
|
||||
{lang() == 'en' ? capitalize(props.topic.slug.replace(/-/, ' ')) : props.topic.title}
|
||||
{lang() == 'en' ? capitalize(props.topic.slug.replace(/-/g, ' ')) : props.topic.title}
|
||||
</span>
|
||||
<Show
|
||||
when={props.topic.body}
|
||||
|
|
|
@ -147,7 +147,7 @@ export const AllTopicsView = (props: AllTopicsViewProps) => {
|
|||
{(topic) => (
|
||||
<div class={clsx(styles.topic, 'topic col-sm-12 col-md-8')}>
|
||||
<a href={`/topic/${topic.slug}`}>
|
||||
{lang() == 'en' ? capitalize(topic.slug.replace(/-/, ' ')) : topic.title}
|
||||
{lang() == 'en' ? capitalize(topic.slug.replace(/-/g, ' ')) : topic.title}
|
||||
</a>
|
||||
<span class={styles.articlesCounter}>{topic.stat.shouts}</span>
|
||||
</div>
|
||||
|
|
|
@ -228,7 +228,7 @@ export const FeedView = (props: Props) => {
|
|||
{(topic) => (
|
||||
<span class={clsx(stylesTopic.shoutTopic, styles.topic)}>
|
||||
<a href={`/topic/${topic.slug}`}>
|
||||
{lang() == 'en' ? topic.slug.replace(/-/, ' ') : topic.title}
|
||||
{lang() == 'en' ? topic.slug.replace(/-/g, ' ') : topic.title}
|
||||
</a>{' '}
|
||||
</span>
|
||||
)}
|
||||
|
|
|
@ -72,12 +72,12 @@ export const apiClient = {
|
|||
}
|
||||
return response.data.get_topics_all
|
||||
},
|
||||
getAllAuthors: async () => {
|
||||
const response = await publicGraphQLClient.query(authorsAll, {}).toPromise()
|
||||
getAllAuthors: async (limit: number = 50, offset: number = 0) => {
|
||||
const response = await publicGraphQLClient.query(authorsAll, { limit, offset }).toPromise()
|
||||
if (response.error) {
|
||||
console.debug('[graphql.client.core] get_authors_all', response.error)
|
||||
console.debug('[graphql.client.core] load_authors_all', response.error)
|
||||
}
|
||||
return response.data.get_authors_all
|
||||
return response.data.load_authors_all
|
||||
},
|
||||
getAuthor: async (params: { slug?: string; author_id?: number; user?: string }): Promise<Author> => {
|
||||
const response = await publicGraphQLClient.query(authorBy, params).toPromise()
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { gql } from '@urql/core'
|
||||
|
||||
export default gql`
|
||||
query AuthorsAllQuery {
|
||||
get_authors_all {
|
||||
query AuthorsAllQuery($limit: Int, $offset: Int) {
|
||||
load_authors_all(limit: $limit, offset: $offset) {
|
||||
id
|
||||
slug
|
||||
name
|
||||
|
|
|
@ -4,7 +4,7 @@ import type { PageContext } from '../renderer/types'
|
|||
import { apiClient } from '../graphql/client/core'
|
||||
|
||||
export const onBeforeRender = async (_pageContext: PageContext) => {
|
||||
const allAuthors = await apiClient.getAllAuthors()
|
||||
const allAuthors = await apiClient.getAllAuthors() // limit 50, offset 0
|
||||
|
||||
const pageProps: PageProps = { allAuthors, seo: { title: '' } }
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user