vue-storefront-api icon indicating copy to clipboard operation
vue-storefront-api copied to clipboard

dispatch('stock/list', { skus: skus }) from vue-storefront gets wrong data back - if SKU contains comma.

Open mortenhartvig opened this issue 5 years ago • 4 comments

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(',')

.....

})

mortenhartvig avatar Jun 09 '20 09:06 mortenhartvig

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 :/

pkarw avatar Jun 16 '20 06:06 pkarw

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 avatar Jun 16 '20 09:06 ResuBaka

@ResuBaka good point

pkarw avatar Jun 18 '20 11:06 pkarw

@ResuBaka i think we should have it implemented in storefront-api as it's the replacement for vue-storefornt-api starting with VSF1.13

pkarw avatar Jun 18 '20 11:06 pkarw