Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix sku array to string paramters #5

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

tdugue
Copy link

@tdugue tdugue commented May 22, 2019

view store front api changed sku parameters from string to array

{sku: '123', stockId:null}

@@ -8,8 +8,8 @@ module.exports = function (restClient) {
}
return false;
}
module.check = (sku) => {
url += `check?sku=${sku}`;
module.check = (stock) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to keep backward compatibility, can you please change it to module.check = (sku, stockId) => {?

module.check = (stock) => {
url += `check?sku=${stock.sku}&stockId=${stock.stockId}`;
module.check = (sku, stockId) => {
url += `check?sku=${sku}&stockId=${stockId}`;
return restClient.get(url).then((data)=> {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @gibkigonzo ,

I made the change, is it good for you ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey :) thanks for update ❤️
can you please add one more change?

url += `check?sku=${sku}`;
if (stockId) {
  url += `&stockId=${stockId}`;
]

to prevent of creating &stockId=undefined

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's good, it's done, thank you.

I still have a question.

It's been a 1 year so I can't remember exactly but to remember it's in this file

https://github.com/DivanteLtd/vue-storefront-api/blob/master/src/api/stock.js#L48

it is an object that we receive as the first parameter.

You made a change here to make it work

https://github.com/DivanteLtd/vue-storefront-api/blob/master/src/api/stock.js#L48

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ow, you are right. Sorry for misleading. Yes, then we need to do this as you proposed

  module.check = (stock) => {
    url += `check?sku=${stock.sku}&stockId=${stock.stockId}`;

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made the modification :)

Copy link

@gibkigonzo gibkigonzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants