feat: re-apply timelines loading optimization (#524)

Co-authored-by: Daniel Roe <daniel@roe.dev>
This commit is contained in:
patak 2022-12-26 06:39:18 +01:00 committed by GitHub
parent db7f82422e
commit baa2696d31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 155 additions and 99 deletions

View file

@ -2,7 +2,8 @@ export default defineNuxtPlugin(async (nuxtApp) => {
const masto = createMasto()
if (process.client) {
const { query } = useRoute()
const { query, path } = useRoute()
const router = useRouter()
const user = typeof query.server === 'string' && typeof query.token === 'string'
? {
server: query.server,
@ -13,8 +14,13 @@ export default defineNuxtPlugin(async (nuxtApp) => {
nuxtApp.hook('app:suspense:resolve', () => {
// TODO: improve upstream to make this synchronous (delayed auth)
if (!masto.loggedIn.value)
masto.loginTo(user)
if (!masto.loggedIn.value) {
masto.loginTo(user).then(() => {
// This only cleans up the URL; page content should stay the same
if (path === '/signin/callback')
router.push('/home')
})
}
})
}