This commit is contained in:
Henry Dollman
2024-07-08 18:44:07 -04:00
parent 86ddb0ac12
commit 309bbf1fba
3 changed files with 82 additions and 31 deletions

View File

@@ -1,12 +1,28 @@
import { useEffect } from 'preact/hooks'
import { pb } from '@/lib/stores'
import { SystemRecord } from '@/types'
import { useEffect, useState } from 'preact/hooks'
import { useRoute } from 'wouter-preact'
export function ServerDetail() {
const [_, params] = useRoute('/server/:name')
const [node, setNode] = useState({} as SystemRecord)
useEffect(() => {
document.title = `Server: ${params!.name}`
document.title = params!.name
}, [])
return <>Info for {params!.name}</>
useEffect(() => {
pb.collection<SystemRecord>('systems')
.getFirstListItem(`name="${params!.name}"`)
.then((record) => {
setNode(record)
})
})
return (
<>
<h1>{node.name}</h1>
<pre>{JSON.stringify(node, null, 2)}</pre>
</>
)
}