Fix ts errors

This commit is contained in:
r-freeman 2023-02-22 22:40:36 +00:00
parent 480111d758
commit 7797d83efa
2 changed files with 12 additions and 6 deletions

View File

@ -101,8 +101,14 @@ function AnimatedBars() {
)
}
type PlayerStateResponse = {
data: Song
error: string
isLoading: boolean
}
function usePlayerState(path: string) {
const {data, error, isLoading} = useSWR(`/api/spotify/${path}`, fetcher)
const {data, error, isLoading} = useSWR(`/api/spotify/${path}`, fetcher) as PlayerStateResponse
return {
song: data,

View File

@ -15,11 +15,11 @@ const config = {
}
export default function Dashboard({metrics}: { metrics: MetricGroup }) {
const {data: tempData} = useSWR('api/grafana/temp', fetcher, config)
const {data: sysLoadData} = useSWR('api/grafana/sysload', fetcher, config)
const {data: ramData} = useSWR('api/grafana/ram', fetcher, config)
const {data: rootFsData} = useSWR('api/grafana/rootfs', fetcher, config)
const {data: uptimeData} = useSWR('api/grafana/uptime', fetcher, config)
const tempData = (useSWR('api/grafana/temp', fetcher, config)).data as { temp: string }
const sysLoadData = (useSWR('api/grafana/sysload', fetcher, config)).data as { sysLoad: string }
const ramData = (useSWR('api/grafana/ram', fetcher, config)).data as { ramUsage: string }
const rootFsData = (useSWR('api/grafana/rootfs', fetcher, config)).data as { rootFsUsage: string }
const uptimeData = (useSWR('api/grafana/uptime', fetcher, config)).data as { days: number }
return (
<>