Merge pull request #460 from Discours/hotfix/author-profile
Hotfix/author profile
This commit is contained in:
commit
aebff60263
|
@ -76,17 +76,24 @@ export const AuthorView = (props: Props) => {
|
||||||
|
|
||||||
const fetchData = async (slug: string) => {
|
const fetchData = async (slug: string) => {
|
||||||
try {
|
try {
|
||||||
const [subscriptionsResult, followersResult, authorResult] = await Promise.all([
|
const [followsResult, followersResult, authorResult] = await Promise.all([
|
||||||
apiClient.getAuthorFollows({ slug }),
|
apiClient.getAuthorFollows({ slug }),
|
||||||
apiClient.getAuthorFollowers({ slug }),
|
apiClient.getAuthorFollowers({ slug }),
|
||||||
loadAuthor({ slug }),
|
loadAuthor({ slug }),
|
||||||
])
|
])
|
||||||
const { authors, topics } = subscriptionsResult
|
const { authors, topics, error } = followsResult
|
||||||
|
if (error) {
|
||||||
|
console.error(error)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
console.debug(authorResult)
|
||||||
setAuthor(authorResult)
|
setAuthor(authorResult)
|
||||||
|
console.debug(authors, topics)
|
||||||
setFollowing([...(authors || []), ...(topics || [])])
|
setFollowing([...(authors || []), ...(topics || [])])
|
||||||
|
console.debug(followersResult)
|
||||||
setFollowers(followersResult || [])
|
setFollowers(followersResult || [])
|
||||||
|
|
||||||
console.debug('[components.Author] following data loaded', subscriptionsResult)
|
console.debug('[components.Author] author follows:', followsResult)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('[components.Author] fetch error', error)
|
console.error('[components.Author] fetch error', error)
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ export const PublishSettings = (props: Props) => {
|
||||||
|
|
||||||
const composeDescription = () => {
|
const composeDescription = () => {
|
||||||
if (!props.form.description) {
|
if (!props.form.description) {
|
||||||
const cleanFootnotes = props.form.body.replaceAll(/<footnote data-value=".*?">.*?<\/footnote>/g, '')
|
const cleanFootnotes = props.form.body.replaceAll(/<footnote data-value=".*?">(.*?)<\/footnote>/g, '')
|
||||||
const leadText = cleanFootnotes.replaceAll(/<\/?[^>]+(>|$)/gi, ' ')
|
const leadText = cleanFootnotes.replaceAll(/<\/?[^>]+(>|$)/gi, ' ')
|
||||||
return shorten(leadText, DESCRIPTION_MAX_LENGTH).trim()
|
return shorten(leadText, DESCRIPTION_MAX_LENGTH).trim()
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,18 +8,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.unswiped {
|
|
||||||
width: 100%;
|
|
||||||
margin: 2rem 0;
|
|
||||||
margin-bottom: 6rem;
|
|
||||||
padding-bottom: 2rem;
|
|
||||||
display: block;
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.Swiper {
|
.Swiper {
|
||||||
display: block;
|
display: block;
|
||||||
margin: 2rem 0;
|
margin: 2rem 0;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import type {
|
import type {
|
||||||
Author,
|
Author,
|
||||||
AuthorFollowsResult,
|
|
||||||
CommonResult,
|
CommonResult,
|
||||||
FollowingEntity,
|
FollowingEntity,
|
||||||
LoadShoutsOptions,
|
LoadShoutsOptions,
|
||||||
|
@ -134,7 +133,7 @@ export const apiClient = {
|
||||||
slug?: string
|
slug?: string
|
||||||
author_id?: number
|
author_id?: number
|
||||||
user?: string
|
user?: string
|
||||||
}): Promise<AuthorFollowsResult> => {
|
}): Promise<CommonResult> => {
|
||||||
const response = await publicGraphQLClient.query(authorFollows, params).toPromise()
|
const response = await publicGraphQLClient.query(authorFollows, params).toPromise()
|
||||||
return response.data.get_author_follows
|
return response.data.get_author_follows
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { gql } from '@urql/core'
|
||||||
export default gql`
|
export default gql`
|
||||||
query GetAuthorFollows($slug: String, $user: String, $author_id: Int) {
|
query GetAuthorFollows($slug: String, $user: String, $author_id: Int) {
|
||||||
get_author_follows(slug: $slug, user: $user, author_id: $author_id) {
|
get_author_follows(slug: $slug, user: $user, author_id: $author_id) {
|
||||||
|
error
|
||||||
authors {
|
authors {
|
||||||
id
|
id
|
||||||
slug
|
slug
|
||||||
|
|
Loading…
Reference in New Issue
Block a user