Skip to content

Commit bf16215

Browse files
author
MaxGenash
committed
feat: strf-8282 - use sites instead of channels API
1 parent 00b4571 commit bf16215

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lib/stencil-push.utils.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ utils.promptUserForChannel = async (options) => {
350350
}
351351

352352
if (channels.length < 2) {
353-
return { ...options, channelId: channels[0].id };
353+
return { ...options, channelId: channels[0].channel_id };
354354
}
355355

356356
const questions = [
@@ -359,8 +359,8 @@ utils.promptUserForChannel = async (options) => {
359359
name: 'channelId',
360360
message: 'Which channel would you like to use?',
361361
choices: channels.map((channel) => ({
362-
name: channel.name,
363-
value: channel.id,
362+
name: channel.url,
363+
value: channel.channel_id,
364364
})),
365365
},
366366
];

lib/theme-api-client.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,18 @@ async function getChannelActiveTheme({ accessToken, apiHost, storeHash, channelI
139139
);
140140
}
141141
}
142+
142143
/**
143144
* @param {object} options
144145
* @param {string} options.accessToken
145146
* @param {string} options.apiHost
146147
* @param {string} options.storeHash
147-
* @returns {Promise<object[]>}
148+
* @returns {Promise<[{channel_id, url}]>}
148149
*/
149150
async function getStoreChannels({ accessToken, apiHost, storeHash }) {
150151
try {
151152
const response = await networkUtils.sendApiRequest({
152-
url: `${apiHost}/stores/${storeHash}/v3/channels?platform=bigcommerce&type=storefront&available=true`,
153+
url: `${apiHost}/stores/${storeHash}/v3/sites`,
153154
accessToken,
154155
});
155156
return response.data.data;

0 commit comments

Comments
 (0)