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)
|
const [sessionChecked, setSessionChecked] = createSignal(false)
|
||||||
createEffect(() => {
|
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)
|
setSessionChecked(true)
|
||||||
console.info('preloaded my own profile')
|
const appdata = session()?.user.app_data
|
||||||
const { profile, authors, topics } = session().user.app_data
|
if (appdata) {
|
||||||
setFollowers(myFollowers)
|
console.info('preloaded my own profile')
|
||||||
setAuthor(profile)
|
const { authors, followers, topics } = appdata
|
||||||
setFollowing([...authors, ...topics])
|
setFollowers(myFollowers)
|
||||||
|
setAuthor(profile)
|
||||||
|
setFollowing([...authors, ...topics])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -73,7 +80,7 @@ export const AuthorView = (props: Props) => {
|
||||||
const [subscriptionsResult, followersResult, authorResult] = await Promise.all([
|
const [subscriptionsResult, 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 } = subscriptionsResult
|
||||||
setAuthor(authorResult)
|
setAuthor(authorResult)
|
||||||
|
|
|
@ -80,10 +80,13 @@ export const FollowingProvider = (props: { children: JSX.Element }) => {
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
if (author()) {
|
if (author()) {
|
||||||
try {
|
try {
|
||||||
const { authors, followers, topics } = session().user.app_data
|
const appdata = session()?.user.app_data
|
||||||
setSubscriptions({ authors, topics })
|
if (appdata) {
|
||||||
setFollowers(followers)
|
const { authors, followers, topics } = appdata
|
||||||
if (!authors) fetchData()
|
setSubscriptions({ authors, topics })
|
||||||
|
setFollowers(followers)
|
||||||
|
if (!authors) fetchData()
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,10 +220,13 @@ export const SessionProvider = (props: {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { profile } = session().user.app_data
|
const appdata = session()?.user.app_data
|
||||||
setAuthor(profile)
|
if (appdata) {
|
||||||
addAuthors([profile])
|
const { profile } = appdata
|
||||||
if (!profile) loadAuthor()
|
setAuthor(profile)
|
||||||
|
addAuthors([profile])
|
||||||
|
if (!profile) loadAuthor()
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user