refactor: tidy composables

This commit is contained in:
三咲智子 2023-01-07 02:40:15 +08:00
parent bf8070c4b9
commit e0741d58a9
No known key found for this signature in database
GPG key ID: 69992F2250DFD93E
14 changed files with 177 additions and 175 deletions

View file

@ -0,0 +1,11 @@
import type { ElkMasto } from '~/types'
export const useMasto = () => useNuxtApp().$masto as ElkMasto
export const isMastoInitialised = computed(() => process.client && useMasto().loggedIn.value)
export const onMastoInit = (cb: () => unknown) => {
watchOnce(isMastoInitialised, () => {
cb()
}, { immediate: isMastoInitialised.value })
}