This commit is contained in:
Henry Dollman
2024-07-13 23:51:22 -04:00
parent 054a56c316
commit 0af3138ef7
17 changed files with 267 additions and 201 deletions

View File

@@ -4,8 +4,6 @@ import { SystemRecord } from '@/types'
import { createRouter } from '@nanostores/router'
export const pb = new PocketBase('/')
// @ts-ignore
pb.authStore.storageKey = 'pb_admin_auth'
export const $router = createRouter(
{
@@ -20,9 +18,6 @@ export const navigate = (urlString: string) => {
}
export const $authenticated = atom(pb.authStore.isValid)
pb.authStore.onChange(() => {
$authenticated.set(pb.authStore.isValid)
})
export const $servers = atom([] as SystemRecord[])

View File

@@ -54,3 +54,5 @@ export const formatShortDate = (timestamp: string) => shortDateFormatter.format(
export const updateFavicon = (newIconUrl: string) =>
((document.querySelector("link[rel='icon']") as HTMLLinkElement).href = newIconUrl)
export const isAdmin = () => pb.authStore.model?.admin