resolvers-updates

This commit is contained in:
Untone 2023-12-10 01:15:02 +03:00
parent 44af27d7a5
commit e00086ee70
8 changed files with 12 additions and 12 deletions

View File

@ -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())

View File

@ -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 (

View File

@ -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}

View File

@ -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>

View File

@ -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>
)}

View File

@ -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()

View File

@ -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

View File

@ -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: '' } }