Skip to content

Commit

Permalink
changed to use env var for org_id
Browse files Browse the repository at this point in the history
  • Loading branch information
lamATnginx committed Oct 8, 2024
1 parent 07b869c commit 2522910
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions assets/js/coveo.js
Original file line number Diff line number Diff line change
@@ -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("f5networkx1h1607h", searchToken.token, "https://f5networkx1h1607h.org.coveo.com/rest/search");
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");
Expand Down

0 comments on commit 2522910

Please # to comment.