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

Users should be directly able to navigate to the product detail page (#1yzcv99). #81

Merged
merged 12 commits into from
Aug 26, 2022

Conversation

meet-aniket
Copy link
Contributor

image

@@ -18,7 +18,7 @@ const state: any = {
}

const persistState = createPersistedState({
paths: ['user', 'product.uploadProducts'],
paths: ['user', 'product.uploadProducts', 'product.current'],
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should not persist current when we are fetching details on load

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed current from persist state and tested whether we are losing or not our current product.

@@ -162,6 +165,12 @@
showToast(translate("Enter the stock count for the product"))
}
},
fetchProduct(sku: any) {
const payload = {
currentSku: sku
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not?

Suggested change
currentSku: sku
sku: sku

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated code and removed unwanted payload which was created.

if(currentProduct){
commit(types.PRODUCT_CURRENT_UPDATED, { product: currentProduct })
}
else{
Copy link
Contributor

Choose a reason for hiding this comment

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

If-else should be in continuity and there are spacing issues

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated code and changed spacing around if-else.

…ved spacing on if else statements (#1yzcv99).
if(currentProduct) {
commit(types.PRODUCT_CURRENT_UPDATED, { product: currentProduct })
} else {
const resp = await ProductService.fetchProducts({
Copy link
Contributor

Choose a reason for hiding this comment

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

Handle the case when API returns an error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sir, updated code.

// used sku as we are currently only using sku to search for the product
"filters": ['sku: ' + '*' + payload + '*', 'isVirtual: false'],
})
if(resp.status === 200 && resp.data.response?.numFound > 0 && !hasError(resp)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if(resp.status === 200 && resp.data.response?.numFound > 0 && !hasError(resp)) {
if(resp.status === 200 && !hasError(resp) && resp.data.response?.numFound > 0 ) {

@adityasharma7 adityasharma7 merged commit 8b05a64 into hotwax:main Aug 26, 2022
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.

4 participants