Initial commit

This commit is contained in:
2026-04-17 23:26:01 +00:00
commit 2ea4ca5d52
409 changed files with 63459 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
import type { ReactiveAuthStore } from '~/plugins/pocketbase'
/**
* Returns the PocketBase client and a reactive ref of the auth store.
*/
export const usePocketBase = () => {
const { $pb } = useNuxtApp()
if (!$pb) throw new Error('Pocketbase plugin not accessible')
return {
pb: $pb,
/**
* Reactive wrapper around the PocketBase auth store.
* Access state via `authStore.value.isValid`, `.record`, `.token`, `.isSuperuser` etc.
* Use only for reactive access; for imperative methods use `$pb.authStore` directly.
*/
authStore: ($pb.authStore as ReactiveAuthStore).ref
}
}