21 lines
374 B
TypeScript
21 lines
374 B
TypeScript
'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
|
|
} |