From a6f7d1c3fbd943fb0fbe1b4dc9753ea7b200165c Mon Sep 17 00:00:00 2001 From: Lam <150060045+lamATnginx@users.noreply.github.com> Date: Fri, 11 Oct 2024 09:26:58 -0700 Subject: [PATCH] chore: added org id to coveo endpoint (#90) * chore: added org id to coveo endpoint * added URI to configureCloudV2Endpoint * changed to use env var for org_id --- assets/js/coveo.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/js/coveo.js b/assets/js/coveo.js index 3b363fa..ee52d14 100644 --- a/assets/js/coveo.js +++ b/assets/js/coveo.js @@ -1,15 +1,15 @@ document.addEventListener('DOMContentLoaded', async function () { // Netlify function to get the coveo search token via API - async function getSearchToken() { + async function getsearchObj() { const response = await fetch( window.location.origin+"/api/v1/auth/search_token" ); return response.json(); } - const searchToken = await getSearchToken() - Coveo.SearchEndpoint.configureCloudV2Endpoint("", searchToken.token); + const searchObj = await getsearchObj() + Coveo.SearchEndpoint.configureCloudV2Endpoint(searchObj.org_id, searchObj.token, `https://${searchObj.org_id}.org.coveo.com/rest/search`); const root = document.getElementById("search"); const searchBoxRoot = document.getElementById("searchbox");