Skip to content

Commit

Permalink
collections.js : Updated function listCampaignCollections to get the …
Browse files Browse the repository at this point in the history
…index name from the polaris.js function getSearchIndex()

CollectionsDatasource.js : updated to remove the indexName parameter from the function listCampaignCollections
  • Loading branch information
TyroneAEM committed Apr 3, 2024
1 parent 7061619 commit 576e754
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export default class CollectionsDatasource {

this.pageNumber += 1;

const list = await listCampaignCollections('gmo-campaignName:Everyone Can', '108396-1046543',pageNumber);
//Todo Pass in the campaignName
const list = await listCampaignCollections('gmo-campaignName:Everyone Can',pageNumber);

if (this.pageNumber >= list.nbPages){
this.lastPage = true;
Expand All @@ -45,7 +46,8 @@ export default class CollectionsDatasource {
this.infiniteResultsContainer = infiniteResultsContainer;
this.container = container;

const list = await listCampaignCollections('gmo-campaignName:Everyone Can', '108396-1046543',this.pageNumber);
//Todo Pass in the campaignName
const list = await listCampaignCollections('gmo-campaignName:Everyone Can',this.pageNumber);

infiniteResultsContainer.resultsCallback(
container,
Expand Down
5 changes: 4 additions & 1 deletion scripts/collections.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { getBearerToken } from './security.js';
import {
getSearchIndex,
getAssetHandlerApiKey,
getDeliveryEnvironment,
getBackendApiKey,
Expand Down Expand Up @@ -292,11 +293,13 @@ export async function searchListCollection(limit = undefined, page = 0) {
* @returns {Promise<object>} A promise that resolves with a list of collections.
* @throws {Error} If an HTTP error or network error occurs.
*/
export async function listCampaignCollections(campaignName, indexName, page = 0) {
export async function listCampaignCollections(campaignName, page = 0) {

// Construct the query parameters
const queryParams = new URLSearchParams();

const indexName = getSearchIndex();

if (campaignName) {
queryParams.append('campaignName', campaignName);
}
Expand Down

0 comments on commit 576e754

Please sign in to comment.