elk/plugins/masto.ts
2022-11-14 22:54:30 +08:00

13 lines
354 B
TypeScript

import { login } from 'masto'
export const DEFAULT_SERVER = 'https://mas.to'
export default defineNuxtPlugin((nuxt) => {
const server = useCookie('nuxtodon-server')
const token = useCookie('nuxtodon-token')
const masto = login({
url: server.value || DEFAULT_SERVER,
accessToken: token.value,
})
nuxt.vueApp.provide('masto', masto)
})