diff --git a/client/.env b/client/.env index cf6f92dd..c7b4fead 100644 --- a/client/.env +++ b/client/.env @@ -2,3 +2,5 @@ VITE_APP_NAME="scanR" VITE_HEADER_TAG="dev" VITE_HEADER_TAG_COLOR="blue-ecume" VITE_VERSION=$npm_package_version +VITE_APP_MATOMO_BASE_URL="https://matomo.staging.dataesr.ovh" +VITE_APP_MATOMO_SITE_ID="4" \ No newline at end of file diff --git a/client/src/main.tsx b/client/src/main.tsx index 1b2ab741..fe95125b 100644 --- a/client/src/main.tsx +++ b/client/src/main.tsx @@ -12,7 +12,7 @@ const { VITE_APP_MATOMO_BASE_URL, VITE_APP_MATOMO_SITE_ID } = import.meta.env; const matomo = createInstance({ urlBase: VITE_APP_MATOMO_BASE_URL, siteId: VITE_APP_MATOMO_SITE_ID, - disabled: !VITE_APP_MATOMO_BASE_URL || !VITE_APP_MATOMO_SITE_ID, + disabled: import.meta.env.DEV, configurations: { disableCookies: true, }, diff --git a/client/src/pages/search/he.tsx b/client/src/pages/search/he.tsx index 53cde9ad..e56a7b4b 100644 --- a/client/src/pages/search/he.tsx +++ b/client/src/pages/search/he.tsx @@ -47,7 +47,7 @@ export default function HEPartners() { ? data.length >= MAX_RESULTS_BEFORE_USER_CLICK : false; - const [keywords, setKeywords] = useState(() => currentQuery.split('|')) + const [keywords, setKeywords] = useState(currentQuery?.split('|')) if (isError || dataError) return diff --git a/client/src/pages/search/hooks/useHeData.ts b/client/src/pages/search/hooks/useHeData.ts index a5eb3639..250b13bd 100644 --- a/client/src/pages/search/hooks/useHeData.ts +++ b/client/src/pages/search/hooks/useHeData.ts @@ -1,6 +1,7 @@ import { useQuery } from "@tanstack/react-query"; import { useEffect, useMemo } from "react"; import { useParams, useSearchParams } from "react-router-dom"; +import { getTopics } from "../../../api/topics"; type TopicData = { TopicDetails: TopicsDetails, @@ -27,10 +28,7 @@ export default function useHeData() { const { data, isFetching, isError, error } = useQuery({ queryKey: ["he-call-data", id], - queryFn: async () => { - const res = await fetch(`https://scanr.dataesr.ovh/topics/${id}`); - return res.json(); - }, + queryFn: () => getTopics(id), enabled: !!id, });