mirror of
https://github.com/henrygd/beszel.git
synced 2025-12-17 18:56:17 +01:00
site updates
This commit is contained in:
@@ -1,11 +1,24 @@
|
||||
import PocketBase from 'pocketbase'
|
||||
import { atom } from 'nanostores'
|
||||
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(
|
||||
{
|
||||
home: '/',
|
||||
server: '/server/:name',
|
||||
},
|
||||
{ links: false }
|
||||
)
|
||||
|
||||
export const navigate = (urlString: string) => {
|
||||
$router.open(urlString)
|
||||
}
|
||||
|
||||
export const $servers = atom([] as SystemRecord[])
|
||||
|
||||
export const $authenticated = atom(pb.authStore.isValid)
|
||||
|
||||
@@ -31,3 +31,14 @@ export const updateServerList = () => {
|
||||
$servers.set(records)
|
||||
})
|
||||
}
|
||||
|
||||
export const shortDateFormatter = new Intl.DateTimeFormat('en-US', {
|
||||
// day: 'numeric',
|
||||
// month: 'numeric',
|
||||
// year: '2-digit',
|
||||
// hour12: false,
|
||||
hour: 'numeric',
|
||||
minute: 'numeric',
|
||||
})
|
||||
|
||||
export const formatDateShort = (timestamp: string) => shortDateFormatter.format(new Date(timestamp))
|
||||
|
||||
Reference in New Issue
Block a user