From 405dc33dba63f008f45b76061a8f1be5031a1d5d Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Thu, 2 Mar 2023 17:02:12 +0700 Subject: midtrans integration --- src/lib/home/api/popularProductApi.js | 2 +- src/lib/home/hooks/useCategoryHome.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src/lib/home') diff --git a/src/lib/home/api/popularProductApi.js b/src/lib/home/api/popularProductApi.js index 5a6d3212..37e4390e 100644 --- a/src/lib/home/api/popularProductApi.js +++ b/src/lib/home/api/popularProductApi.js @@ -2,7 +2,7 @@ import axios from 'axios' const popularProductApi = async () => { const dataPopularProducts = await axios( - `${process.env.SELF_HOST}/api/shop/search?q=*&page=1&orderBy=popular` + `${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/search?q=*&page=1&orderBy=popular` ) return dataPopularProducts.data.response } diff --git a/src/lib/home/hooks/useCategoryHome.js b/src/lib/home/hooks/useCategoryHome.js index cfaa3d9c..ea9f8d6a 100644 --- a/src/lib/home/hooks/useCategoryHome.js +++ b/src/lib/home/hooks/useCategoryHome.js @@ -3,7 +3,9 @@ import { useQuery } from 'react-query' const useCategoryHome = ({ id }) => { const fetchCategoryHome = async () => await categoryHomeApi({ id }) - const { isLoading, data } = useQuery(`categoryHome-${id}`, fetchCategoryHome) + const { isLoading, data } = useQuery(`categoryHome-${id}`, fetchCategoryHome, { + refetchOnWindowFocus: false + }) return { categoryHome: { data, isLoading } -- cgit v1.2.3