Skip to content

Commit

Permalink
fix(get-store-id): returns channel info object on promise chain
Browse files Browse the repository at this point in the history
BREAKING CHANGE: changed returned object on 'getStoreId' resolve
  • Loading branch information
leomp12 committed Jul 21, 2019
1 parent 2bf6f9e commit c5c3a50
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/methods/get-store-id.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ const getStoreId = domain => {
}
}

// returns Store ID number on promise chain
return data.store_id
// returns channel info object on promise chain
return data
})
}

Expand All @@ -41,14 +41,19 @@ const getStoreId = domain => {
* @param {string} [domain=location.hostname] - Sales channel domain name, on browser it'll
* use global location object by default
*
* @returns {Promise<storeId|error>}
* Promise resolved with `storeId` number or rejected with
* @returns {Promise<{store_id,store_object_id}|error>}
* Promise resolved with sales channel info (object with `store_id` and `store_object_id`)
* or rejected with
* [axios error]{@link https://github.com/axios/axios#handling-errors}.
*
* @example
ecomClient.getStoreId('shop-plus.e-com.plus')
.then(storeId => console.log(storeId))
.then(channel => {
console.log(channel.store_id)
console.log(channel.store_object_id)
console.log(channel)
})
.catch(error => {
console.error(error)
if (error.response) {
Expand Down

0 comments on commit c5c3a50

Please sign in to comment.