diff --git a/src/components/Hit.jsx b/src/components/Hit.jsx index b616981..9b8aabf 100644 --- a/src/components/Hit.jsx +++ b/src/components/Hit.jsx @@ -5,10 +5,10 @@ import { Highlight, } from 'react-instantsearch-hooks-web'; -export default function Hit({hit, sendEvent}) { +export default function Hit({hit}) { return (
- sendEvent('click', hit, 'Card Clicked')}> + @@ -22,12 +20,12 @@ export default function Search() {
diff --git a/src/effects/usePokemonData.js b/src/effects/usePokemonData.js index 8136f51..cbf761a 100644 --- a/src/effects/usePokemonData.js +++ b/src/effects/usePokemonData.js @@ -1,11 +1,7 @@ -import algoliasearch from "algoliasearch"; +import { searchClient, indexName } from '../utilities/algolia'; import { useEffect, useState } from "react"; -const searchClient = algoliasearch( - "OKF83BFQS4", - "2ee1381ed11d3fe70b60605b1e2cd3f4" -); -const index = searchClient.initIndex("pokemon-cards"); +const index = searchClient.initIndex(indexName); export const usePokemonData = (cardId) => { const [pokemonData, setPokemonData] = useState({ diff --git a/src/utilities/algolia.js b/src/utilities/algolia.js new file mode 100644 index 0000000..7e3cc6f --- /dev/null +++ b/src/utilities/algolia.js @@ -0,0 +1,7 @@ +import algoliasearch from 'algoliasearch' + +export const appId = process.env.REACT_APP_ALGOLIA_APP_ID || '' +export const appKey = process.env.REACT_APP_ALGOLIA_API_KEY || '' +export const indexName = process.env.REACT_APP_ALGOLIA_INDEX_NAME || '' +export const userToken = process.env.REACT_APP_USER_TOKEN || '' +export const searchClient = algoliasearch(appId, appKey)