vue-storefront-api
vue-storefront-api copied to clipboard
dispatch('stock/list', { skus: skus }) from vue-storefront gets wrong data back - if SKU contains comma.
src/api/stock.js
(only affects the list query and not single sku stock query)
api.get('/list', (req, res) => {
.....
// This line splits everything by comma, but if any given SKU contains a comma, it will break the SKU into two seperate parts, which is a big problem when checking multiple SKU's on a list.
const skuArray = req.query.skus.split(',')
.....
})
Please maybe try to urlencode (` = %2C(https://stackoverflow.com/questions/6182356/what-is-2c-in-a-url)) the SKUs before sending them out to the VSF-API? this would require a change in the VSF itself
The other option is to change the SKUs :/
An other option would be to have the split option be configurable, with that every project could use a separator that fits there needs. This would still need work on the VSF side so you could set it via a config value too.
@ResuBaka good point
@ResuBaka i think we should have it implemented in storefront-api as it's the replacement for vue-storefornt-api starting with VSF1.13