mirror of
https://github.com/r-freeman/portfolio.git
synced 2024-11-22 18:15:41 +00:00
Changed type in views component
This commit is contained in:
parent
de56c2aec7
commit
7170e786dd
@ -3,7 +3,7 @@ import {ElementType, useEffect} from 'react'
|
|||||||
import fetcher from '@/lib/fetcher'
|
import fetcher from '@/lib/fetcher'
|
||||||
import {numberFormat} from '@/lib/numberFormat'
|
import {numberFormat} from '@/lib/numberFormat'
|
||||||
|
|
||||||
type ViewsType = {
|
type ViewsResponse = {
|
||||||
views: string
|
views: string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ type ViewsProps = {
|
|||||||
const updateViews = (slug: string) => fetcher(`/api/views/${slug}`, {method: 'POST'})
|
const updateViews = (slug: string) => fetcher(`/api/views/${slug}`, {method: 'POST'})
|
||||||
|
|
||||||
export function Views({as: Component = 'span', slug, className, shouldUpdateViews = true}: ViewsProps) {
|
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,
|
revalidateOnFocus: false,
|
||||||
revalidateOnMount: true
|
revalidateOnMount: true
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user