mirror of
https://github.com/r-freeman/portfolio.git
synced 2024-11-23 00:05:41 +00:00
Updated views component
This commit is contained in:
parent
cbdd89d757
commit
4ff2a2939a
@ -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(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user