Skip to content

Commit a6f7d1c

Browse files
authored
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
1 parent 19e7409 commit a6f7d1c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

assets/js/coveo.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
document.addEventListener('DOMContentLoaded', async function () {
22

33
// Netlify function to get the coveo search token via API
4-
async function getSearchToken() {
4+
async function getsearchObj() {
55
const response = await fetch(
66
window.location.origin+"/api/v1/auth/search_token"
77
);
88
return response.json();
99
}
1010

11-
const searchToken = await getSearchToken()
12-
Coveo.SearchEndpoint.configureCloudV2Endpoint("", searchToken.token);
11+
const searchObj = await getsearchObj()
12+
Coveo.SearchEndpoint.configureCloudV2Endpoint(searchObj.org_id, searchObj.token, `https://${searchObj.org_id}.org.coveo.com/rest/search`);
1313

1414
const root = document.getElementById("search");
1515
const searchBoxRoot = document.getElementById("searchbox");

0 commit comments

Comments
 (0)