1
0
Fork 0
This repository has been archived on 2023-12-03. You can view files and clone it, but cannot push or open issues or pull requests.
chellaris-galaxy-political-.../components/tables/empires.tsx

21 lines
374 B
TypeScript
Raw Permalink Normal View History

'use client';
import useSWR from "swr";
const fetcher = async (url:any) => await fetch(url).then((res) => res.json());
export const EmpireStats = () => {
const {data} = useSWR('/api/v1/empires',fetcher);
let ret;
if (data) {
ret = (
<div className="active">{data.empireCount} Empires</div>
)
}
else {
ret = (<div></div>)
}
return ret
}