🙋 test getStaticProps with revalidate

This commit is contained in:
lytrankieio123
2021-10-04 11:17:30 +07:00
parent 21b0200205
commit 6b7b8e4ad1
6 changed files with 160 additions and 9 deletions

View File

@@ -3,7 +3,7 @@ import { getAllFacetsQuery } from '@framework/utils/queries/get-all-facets-query
import gglFetcher from 'src/utils/gglFetcher'
import useSWR from 'swr'
const useFacets = (options: QueryFacetsArgs) => {
const useFacets = (options?: QueryFacetsArgs) => {
const { data, isValidating, ...rest } = useSWR<GetAllFacetsQuery>([getAllFacetsQuery, options], gglFetcher)
return { items: data?.facets.items, totalItems: data?.facets.totalItems, loading: isValidating, ...rest }
}