Use searchParams inside eventsFetcher

This commit is contained in:
Scott Stancil 2023-09-15 12:30:59 -04:00
parent e52eced7a0
commit f810e7cf0e

View File

@ -88,13 +88,13 @@ export default function Events({ path, ...props }) {
}); });
const eventsFetcher = useCallback((path, params) => { const eventsFetcher = useCallback((path, params) => {
if (params.event) { if (searchParams.event) {
path = `${path}/${params.event}`; path = `${path}/${searchParams.event}`;
return axios.get(path).then((res) => [res.data]); return axios.get(path).then((res) => [res.data]);
} }
params = { ...params, include_thumbnails: 0, limit: API_LIMIT }; params = { ...params, include_thumbnails: 0, limit: API_LIMIT };
return axios.get(path, { params }).then((res) => res.data); return axios.get(path, { params }).then((res) => res.data);
}, []); }, [searchParams]);
const getKey = useCallback( const getKey = useCallback(
(index, prevData) => { (index, prevData) => {