Skip to content

Commit

Permalink
chore: added org id to coveo endpoint (#90)
Browse files Browse the repository at this point in the history
* chore: added org id to coveo endpoint

* added URI to configureCloudV2Endpoint

* changed to use env var for org_id
  • Loading branch information
lamATnginx authored Oct 11, 2024
1 parent 19e7409 commit a6f7d1c
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("", 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");
Expand Down

0 comments on commit a6f7d1c

Please # to comment.