vue-storefront-api
vue-storefront-api copied to clipboard
Added optional customer token for create order
Closes #501
I wasn't sure of the best way to approach this as it is specific to Magento. I tried taking the advise of @pkarw to only work in the src/api/platform level, but passing the customer token as a parameter has to be handled in src/api/order.ts somehow, and then passed to the proxy. I tried to do this in the least intrusive way I could find, but I don't know how it will impact other platform proxies.
Alternatively, we could potentially add the token to the req.body instead, and then extract it in the Magento 2 proxy, or directly in o2m.js, but I don't know if forcing an additional property to the req.body in the API is a good idea.
Any suggestions or recommendations are welcome.
@ResuBaka Ah, good catch. I have updated those two with the optional parameter. I noticed that the Magento 1 client node module does use a token in the API calls, but the order.js function create would need to be updated to accept this token as well. I don't have a Magento 1 instance I can test this on though, so I don't know how it impacts it. But for now, the parameter is in src/platform/magento1/order.js if the module does get updated in the future.