From 7170e786dd996b327a39c0a21eb1a81c5ae83013 Mon Sep 17 00:00:00 2001 From: r-freeman Date: Mon, 30 Jan 2023 16:30:44 +0000 Subject: [PATCH] Changed type in views component --- components/Views.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/Views.tsx b/components/Views.tsx index 2b3d755..7f62412 100644 --- a/components/Views.tsx +++ b/components/Views.tsx @@ -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(`/api/views/${slug}`, fetcher, { + const {data} = useSWR(`/api/views/${slug}`, fetcher, { revalidateOnFocus: false, revalidateOnMount: true })