diff --git a/src/components/ItemsSearch/ItemsSearch.tsx b/src/components/ItemsSearch/ItemsSearch.tsx index 404ffb1..b8a3f6a 100644 --- a/src/components/ItemsSearch/ItemsSearch.tsx +++ b/src/components/ItemsSearch/ItemsSearch.tsx @@ -85,16 +85,20 @@ const ItemsSearch: React.FC = ({ items }) => { }, [filterObj, pagingController.pageNum, pagingController.pageSize]); const refetchData = async (filterObj: SearchQuery) => { - // Make sure the API endpoint is correct + + const authHeader = axiosInstance.defaults.headers['Authorization']; + if (!authHeader) { + return; // Exit the function if the token is not set + } + const params ={ pageNum: pagingController.pageNum, pageSize: pagingController.pageSize, ...filterObj, } + try { - console.log("[debug] axiosInstance", axiosInstance) const response = await axiosInstance.get(`${NEXT_PUBLIC_API_URL}/items/getRecordByPage`, { params }); - console.log("[debug] resposne", response) setFilteredItems(response.data.records); setPagingController({ ...pagingController,