post-oauth-fix
This commit is contained in:
parent
69fc0ffd07
commit
0f28fe891a
|
@ -55,13 +55,20 @@ export const AuthorView = (props: Props) => {
|
|||
|
||||
const [sessionChecked, setSessionChecked] = createSignal(false)
|
||||
createEffect(() => {
|
||||
if (!sessionChecked() && props.authorSlug && session()?.user?.app_data?.profile?.slug === props.authorSlug) {
|
||||
if (
|
||||
!sessionChecked() &&
|
||||
props.authorSlug &&
|
||||
session()?.user?.app_data?.profile?.slug === props.authorSlug
|
||||
) {
|
||||
setSessionChecked(true)
|
||||
console.info('preloaded my own profile')
|
||||
const { profile, authors, topics } = session().user.app_data
|
||||
setFollowers(myFollowers)
|
||||
setAuthor(profile)
|
||||
setFollowing([...authors, ...topics])
|
||||
const appdata = session()?.user.app_data
|
||||
if (appdata) {
|
||||
console.info('preloaded my own profile')
|
||||
const { authors, followers, topics } = appdata
|
||||
setFollowers(myFollowers)
|
||||
setAuthor(profile)
|
||||
setFollowing([...authors, ...topics])
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -73,7 +80,7 @@ export const AuthorView = (props: Props) => {
|
|||
const [subscriptionsResult, followersResult, authorResult] = await Promise.all([
|
||||
apiClient.getAuthorFollows({ slug }),
|
||||
apiClient.getAuthorFollowers({ slug }),
|
||||
loadAuthor({ slug })
|
||||
loadAuthor({ slug }),
|
||||
])
|
||||
const { authors, topics } = subscriptionsResult
|
||||
setAuthor(authorResult)
|
||||
|
|
|
@ -80,10 +80,13 @@ export const FollowingProvider = (props: { children: JSX.Element }) => {
|
|||
createEffect(() => {
|
||||
if (author()) {
|
||||
try {
|
||||
const { authors, followers, topics } = session().user.app_data
|
||||
setSubscriptions({ authors, topics })
|
||||
setFollowers(followers)
|
||||
if (!authors) fetchData()
|
||||
const appdata = session()?.user.app_data
|
||||
if (appdata) {
|
||||
const { authors, followers, topics } = appdata
|
||||
setSubscriptions({ authors, topics })
|
||||
setFollowers(followers)
|
||||
if (!authors) fetchData()
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
|
|
|
@ -220,10 +220,13 @@ export const SessionProvider = (props: {
|
|||
}
|
||||
|
||||
try {
|
||||
const { profile } = session().user.app_data
|
||||
setAuthor(profile)
|
||||
addAuthors([profile])
|
||||
if (!profile) loadAuthor()
|
||||
const appdata = session()?.user.app_data
|
||||
if (appdata) {
|
||||
const { profile } = appdata
|
||||
setAuthor(profile)
|
||||
addAuthors([profile])
|
||||
if (!profile) loadAuthor()
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user