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) { 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 { return {
song: data, song: data,

View File

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