Skip to content

Commit

Permalink
feat: strf-8282 - use sites instead of channels API
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxGenash committed Mar 16, 2021
1 parent 00b4571 commit bf16215
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/stencil-push.utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ utils.promptUserForChannel = async (options) => {
}

if (channels.length < 2) {
return { ...options, channelId: channels[0].id };
return { ...options, channelId: channels[0].channel_id };
}

const questions = [
Expand All @@ -359,8 +359,8 @@ utils.promptUserForChannel = async (options) => {
name: 'channelId',
message: 'Which channel would you like to use?',
choices: channels.map((channel) => ({
name: channel.name,
value: channel.id,
name: channel.url,
value: channel.channel_id,
})),
},
];
Expand Down
5 changes: 3 additions & 2 deletions lib/theme-api-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,18 @@ async function getChannelActiveTheme({ accessToken, apiHost, storeHash, channelI
);
}
}

/**
* @param {object} options
* @param {string} options.accessToken
* @param {string} options.apiHost
* @param {string} options.storeHash
* @returns {Promise<object[]>}
* @returns {Promise<[{channel_id, url}]>}
*/
async function getStoreChannels({ accessToken, apiHost, storeHash }) {
try {
const response = await networkUtils.sendApiRequest({
url: `${apiHost}/stores/${storeHash}/v3/channels?platform=bigcommerce&type=storefront&available=true`,
url: `${apiHost}/stores/${storeHash}/v3/sites`,
accessToken,
});
return response.data.data;
Expand Down

0 comments on commit bf16215

Please sign in to comment.