feat: disable SSR

This commit is contained in:
Anthony Fu 2022-11-23 07:08:36 +08:00
parent e59b3e5db2
commit a6578155ae
29 changed files with 109 additions and 175 deletions

View file

@ -1,10 +1,9 @@
import type { MastoClient } from 'masto'
import type { ClientState } from '~/plugins/store.client'
import { login } from 'masto'
import { currentUser } from './accounts'
import { DEFAULT_SERVER } from '~/constants'
export function useMasto() {
return useNuxtApp().$masto as Promise<MastoClient>
}
export function useClientState() {
return useNuxtApp().$clientState as ClientState
}
// TODO: improve upsteam to make this synchronous (delayed auth)
export const masto = await login({
url: `https://${currentUser.value?.server || DEFAULT_SERVER}`,
accessToken: currentUser.value?.token || undefined,
})