summaryrefslogtreecommitdiff
path: root/src/hooks/useAPIClient.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/hooks/useAPIClient.ts')
-rw-r--r--src/hooks/useAPIClient.ts2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/hooks/useAPIClient.ts b/src/hooks/useAPIClient.ts
index b36cfec..f2f2782 100644
--- a/src/hooks/useAPIClient.ts
+++ b/src/hooks/useAPIClient.ts
@@ -23,7 +23,7 @@ export const useProducts = (options = {}): Response<Product[]> => {
export const useProduct = (_id: string): Response<Product> => {
const { data: preloadedProducts } = useProducts({ revalidateOnMount: false });
- const result = useSWR(`/products/${_id}`, fetcher);
+ const result = useSWR(_id && `/products/${_id}`, fetcher);
if (!result.data && result.isValidating) {
// If we are waiting for the first result, check if we can maybe
// get the data from already cached list for the time-being