Changed type in views component

This commit is contained in:
r-freeman 2023-01-30 16:30:44 +00:00
parent de56c2aec7
commit 7170e786dd

View File

@ -3,7 +3,7 @@ import {ElementType, useEffect} from 'react'
import fetcher from '@/lib/fetcher'
import {numberFormat} from '@/lib/numberFormat'
type ViewsType = {
type ViewsResponse = {
views: string
}
@ -17,7 +17,7 @@ type ViewsProps = {
const updateViews = (slug: string) => fetcher(`/api/views/${slug}`, {method: 'POST'})
export function Views({as: Component = 'span', slug, className, shouldUpdateViews = true}: ViewsProps) {
const {data} = useSWR<ViewsType>(`/api/views/${slug}`, fetcher, {
const {data} = useSWR<ViewsResponse>(`/api/views/${slug}`, fetcher, {
revalidateOnFocus: false,
revalidateOnMount: true
})