hotfix followed request

This commit is contained in:
ilya-bkv 2023-04-22 18:32:21 +03:00
parent f8a7e98a8e
commit 24c028a233

View File

@ -56,35 +56,34 @@ export const AuthorView = (props: AuthorProps) => {
const [subscribedTopics, setSubscribedTopics] = createSignal<Topic[]>([]) const [subscribedTopics, setSubscribedTopics] = createSignal<Topic[]>([])
onMount(async () => { onMount(async () => {
if (!props.author.slug) return
try { try {
const userSubscribers = await apiClient.getAuthorFollowers({ slug: props.author.slug }) const userSubscribers = await apiClient.getAuthorFollowers({ slug: props.authorSlug })
setFollowers(userSubscribers) setFollowers(userSubscribers)
} catch (error) { } catch (error) {
console.log('[getAuthorFollowers]', error) console.log('[getAuthorFollowers]', error)
} }
try { try {
const authorSubscriptionsUsers = await apiClient.getAuthorFollowingUsers({ slug: props.author.slug }) const authorSubscriptionsUsers = await apiClient.getAuthorFollowingUsers({ slug: props.authorSlug })
setFollowingUsers(authorSubscriptionsUsers) setFollowingUsers(authorSubscriptionsUsers)
} catch (error) { } catch (error) {
console.log('[getAuthorFollowingUsers]', error) console.log('[getAuthorFollowingUsers]', error)
} }
try { try {
const authorSubscriptionsTopics = await apiClient.getAuthorFollowingTopics({ const authorSubscriptionsTopics = await apiClient.getAuthorFollowingTopics({ slug: props.authorSlug })
slug: props.author.slug
})
setSubscribedTopics(authorSubscriptionsTopics) setSubscribedTopics(authorSubscriptionsTopics)
} catch (error) { } catch (error) {
console.log('[getAuthorFollowing]', error) console.log('[getAuthorFollowing]', error)
} }
})
onMount(() => {
if (!searchParams().by) { if (!searchParams().by) {
changeSearchParam('by', 'rating') changeSearchParam('by', 'rating')
} }
if (sortedArticles().length === PRERENDERED_ARTICLES_COUNT) {
await loadMore()
}
}) })
const loadMore = async () => { const loadMore = async () => {
@ -98,12 +97,6 @@ export const AuthorView = (props: AuthorProps) => {
restoreScrollPosition() restoreScrollPosition()
} }
onMount(async () => {
if (sortedArticles().length === PRERENDERED_ARTICLES_COUNT) {
await loadMore()
}
})
// TODO: use title // TODO: use title
// const title = createMemo(() => { // const title = createMemo(() => {
// const m = searchParams().by // const m = searchParams().by
@ -119,15 +112,6 @@ export const AuthorView = (props: AuthorProps) => {
const [commented, setCommented] = createSignal([]) const [commented, setCommented] = createSignal([])
onMount(async () => {
try {
const authorSubscribers = await apiClient.getAuthorFollowers({ slug: props.authorSlug })
setFollowers(authorSubscribers)
} catch (error) {
console.log('[getAuthorSubscribers]', error)
}
})
createEffect(async () => { createEffect(async () => {
if (searchParams().by === 'commented') { if (searchParams().by === 'commented') {
try { try {
@ -276,6 +260,7 @@ export const AuthorView = (props: AuthorProps) => {
<Match when={searchParams().by === 'subscribed-authors'}> <Match when={searchParams().by === 'subscribed-authors'}>
<div class="wide-container"> <div class="wide-container">
<div class="row"> <div class="row">
asdasd
<For each={followingUsers()}> <For each={followingUsers()}>
{(follower: Author) => ( {(follower: Author) => (
<div class="col-md-6 col-lg-4"> <div class="col-md-6 col-lg-4">