-
Notifications
You must be signed in to change notification settings - Fork 65
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
Conversation
meet-aniket
commented
Apr 7, 2022
…oduct directly (#1yzcv99)
src/store/index.ts
Outdated
@@ -18,7 +18,7 @@ const state: any = { | |||
} | |||
|
|||
const persistState = createPersistedState({ | |||
paths: ['user', 'product.uploadProducts'], | |||
paths: ['user', 'product.uploadProducts', 'product.current'], |
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.
I think we should not persist current when we are fetching details on load
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.
Removed current from persist state and tested whether we are losing or not our current product.
src/views/count.vue
Outdated
@@ -162,6 +165,12 @@ | |||
showToast(translate("Enter the stock count for the product")) | |||
} | |||
}, | |||
fetchProduct(sku: any) { | |||
const payload = { | |||
currentSku: sku |
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.
Why not?
currentSku: sku | |
sku: sku |
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.
Updated code and removed unwanted payload which was created.
src/store/modules/product/actions.ts
Outdated
if(currentProduct){ | ||
commit(types.PRODUCT_CURRENT_UPDATED, { product: currentProduct }) | ||
} | ||
else{ |
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.
If-else should be in continuity and there are spacing issues
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.
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({ |
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.
Handle the case when API returns an error.
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.
Sir, updated code.
to resolve warnings (#1yzcv99).
error related to API (#1yzcv99).
// 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)) { |
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.
if(resp.status === 200 && resp.data.response?.numFound > 0 && !hasError(resp)) { | |
if(resp.status === 200 && !hasError(resp) && resp.data.response?.numFound > 0 ) { |