Updated views component

This commit is contained in:
r-freeman 2023-01-17 22:40:06 +00:00
parent cbdd89d757
commit 4ff2a2939a

View File

@ -13,9 +13,7 @@ type ViewsType = {
} }
export function Views({as: Component = 'span', slug}: { as?: ElementType, slug: string }) { export function Views({as: Component = 'span', slug}: { as?: ElementType, slug: string }) {
const {data} = useSWR<ViewsType>(`/api/views/${slug}`, fetcher, { const {data} = useSWR<ViewsType>(`/api/views/${slug}`, fetcher)
revalidateOnFocus: false
})
const views = Number(data?.views) const views = Number(data?.views)
useEffect(() => { useEffect(() => {