refactor: add onMastoInit
This commit is contained in:
parent
6092b27da6
commit
6729666170
5 changed files with 15 additions and 22 deletions
|
@ -7,6 +7,12 @@ 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 })
|
||||
}
|
||||
|
||||
// @unocss-include
|
||||
export const STATUS_VISIBILITIES = [
|
||||
{
|
||||
|
|
|
@ -86,7 +86,7 @@ export function usePaginator<T>(
|
|||
}, 1000)
|
||||
|
||||
if (!isMastoInitialised.value) {
|
||||
watchOnce(isMastoInitialised, () => {
|
||||
onMastoInit(() => {
|
||||
state.value = 'idle'
|
||||
loadNext()
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue