feat: render app shell with ssr to improve loading experience (#448)
This commit is contained in:
parent
b545efeacc
commit
9395b7031e
35 changed files with 169 additions and 127 deletions
|
@ -73,8 +73,6 @@ export async function loginTo(user?: Omit<UserLogin, 'account'> & { account?: Ac
|
|||
}
|
||||
}
|
||||
|
||||
setMasto(masto)
|
||||
|
||||
if ('server' in route.params && user?.token) {
|
||||
await router.push({
|
||||
...route,
|
||||
|
@ -117,6 +115,7 @@ const notifications = reactive<Record<string, undefined | [Promise<WsEvents>, nu
|
|||
|
||||
export const useNotifications = () => {
|
||||
const id = currentUser.value?.account.id
|
||||
const masto = useMasto()
|
||||
|
||||
const clearNotifications = () => {
|
||||
if (!id || !notifications[id])
|
||||
|
@ -125,10 +124,9 @@ export const useNotifications = () => {
|
|||
}
|
||||
|
||||
async function connect(): Promise<void> {
|
||||
if (!id || notifications[id] || !currentUser.value?.token)
|
||||
if (!isMastoInitialised.value || !id || notifications[id] || !currentUser.value?.token)
|
||||
return
|
||||
|
||||
const masto = useMasto()
|
||||
const stream = masto.stream.streamUser()
|
||||
notifications[id] = [stream, 0]
|
||||
;(await stream).on('notification', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue