author-type-fix
This commit is contained in:
parent
58c4d6eae7
commit
6d12b01d56
|
@ -53,10 +53,10 @@ export const AuthorView = (props: Props) => {
|
||||||
|
|
||||||
// current author
|
// current author
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
if(props.authorSlug) {
|
if (props.authorSlug) {
|
||||||
if (session()?.user?.app_data?.profile?.slug === props.authorSlug) {
|
if (session()?.user?.app_data?.profile?.slug === props.authorSlug) {
|
||||||
console.info('my own profile')
|
console.info('my own profile')
|
||||||
const {profile, authors, topics} = session().user.app_data
|
const { profile, authors, topics } = session().user.app_data
|
||||||
setAuthor(profile)
|
setAuthor(profile)
|
||||||
setFollowing([...authors, ...topics])
|
setFollowing([...authors, ...topics])
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { useFollowing } from '../../../context/following'
|
||||||
import { useLocalize } from '../../../context/localize'
|
import { useLocalize } from '../../../context/localize'
|
||||||
import { useSession } from '../../../context/session'
|
import { useSession } from '../../../context/session'
|
||||||
import { apiClient } from '../../../graphql/client/core'
|
import { apiClient } from '../../../graphql/client/core'
|
||||||
import { Author, Topic } from '../../../graphql/schema/core.gen'
|
import { Author as AuthorType, Topic } from '../../../graphql/schema/core.gen'
|
||||||
import { SubscriptionFilter } from '../../../pages/types'
|
import { SubscriptionFilter } from '../../../pages/types'
|
||||||
import { dummyFilter } from '../../../utils/dummyFilter'
|
import { dummyFilter } from '../../../utils/dummyFilter'
|
||||||
// TODO: refactor styles
|
// TODO: refactor styles
|
||||||
|
@ -23,8 +23,8 @@ export const ProfileSubscriptions = () => {
|
||||||
const { t, lang } = useLocalize()
|
const { t, lang } = useLocalize()
|
||||||
const { author, session } = useSession()
|
const { author, session } = useSession()
|
||||||
const { subscriptions } = useFollowing()
|
const { subscriptions } = useFollowing()
|
||||||
const [following, setFollowing] = (createSignal < Array < Author) | (Topic >> [])
|
const [following, setFollowing] = (createSignal < Array < AuthorType) | (Topic >> [])
|
||||||
const [filtered, setFiltered] = (createSignal < Array < Author) | (Topic >> [])
|
const [filtered, setFiltered] = (createSignal < Array < AuthorType) | (Topic >> [])
|
||||||
const [subscriptionFilter, setSubscriptionFilter] = createSignal < SubscriptionFilter > 'all'
|
const [subscriptionFilter, setSubscriptionFilter] = createSignal < SubscriptionFilter > 'all'
|
||||||
const [searchQuery, setSearchQuery] = createSignal('')
|
const [searchQuery, setSearchQuery] = createSignal('')
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Accessor, JSX, createContext, createEffect, createSignal, useContext }
|
||||||
import { createStore } from 'solid-js/store'
|
import { createStore } from 'solid-js/store'
|
||||||
|
|
||||||
import { apiClient } from '../graphql/client/core'
|
import { apiClient } from '../graphql/client/core'
|
||||||
import { AuthorFollows, FollowingEntity, Author } from '../graphql/schema/core.gen'
|
import { Author, AuthorFollows, FollowingEntity } from '../graphql/schema/core.gen'
|
||||||
|
|
||||||
import { useSession } from './session'
|
import { useSession } from './session'
|
||||||
|
|
||||||
|
@ -83,8 +83,8 @@ export const FollowingProvider = (props: { children: JSX.Element }) => {
|
||||||
const { authors, followers, topics } = session().user.app_data
|
const { authors, followers, topics } = session().user.app_data
|
||||||
setSubscriptions({ authors, topics })
|
setSubscriptions({ authors, topics })
|
||||||
setFollowers(followers)
|
setFollowers(followers)
|
||||||
if(!authors) fetchData()
|
if (!authors) fetchData()
|
||||||
} catch(e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,8 +223,8 @@ export const SessionProvider = (props: {
|
||||||
const { profile } = session().user.app_data
|
const { profile } = session().user.app_data
|
||||||
setAuthor(profile)
|
setAuthor(profile)
|
||||||
addAuthors([profile])
|
addAuthors([profile])
|
||||||
if(!profile) loadAuthor()
|
if (!profile) loadAuthor()
|
||||||
} catch(e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ export const SessionProvider = (props: {
|
||||||
() => props.onStateChangeCallback,
|
() => props.onStateChangeCallback,
|
||||||
() => {
|
() => {
|
||||||
props.onStateChangeCallback(session())
|
props.onStateChangeCallback(session())
|
||||||
}
|
},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user