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(cms-base): push errors from add to cart API call #795
base: main
Are you sure you want to change the base?
fix(cms-base): push errors from add to cart API call #795
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
CodSpeed Performance ReportMerging #795 will not alter performanceComparing Summary
|
@@ -33,7 +33,15 @@ const { product } = toRefs(props); | |||
const { addToCart, quantity } = useAddToCart(product); | |||
|
|||
const addToCartProxy = async () => { | |||
await addToCart(); | |||
const res = await addToCart(); | |||
const errors = Object.values(res.errors); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cart errors should be transformed and translated. Please check how it's done in the demo store
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah nice thanks! Do we also need to handle any translations or can we rely that the API Response is already translated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello 👋
I have created a new Branch from your PR, and changed the part @mdanilowicz mentioned.
Look here: d8e28c8
But to be honest I do not like the part about the quantity. Currently, we would need to search in the line items for the quantity that was added to the cart. Maybe a more generic error message would be easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah nice thanks! Do we also need to handle any translations or can we rely that the API Response is already translated?
Unfortunately, all API errors are in English, even if the context language is different. So, we have to translate it "locally"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description
closes #782
Type of change
Bug fix (non-breaking change that fixes an issue)
ToDo's
Screenshots (if applicable)
Additional context