add to cart error handling

This commit is contained in:
sidharth 2022-02-24 12:46:06 +05:30
parent e59452ddf3
commit f1bad5cf21
2 changed files with 7 additions and 22 deletions

View File

@ -68,14 +68,7 @@
<v-row> <v-row>
<v-col class="py-0 ma-0"> <v-col class="py-0 ma-0">
<p <p
class="fontsize-14 black--text float-left cursor-pointer" class="fontsize-14 black--text float-left"
@click="
goToProductDetails(
product.customAttributes,
product.name,
product.productType
)
"
> >
{{ product.name }} {{ product.name }}
</p> </p>
@ -290,14 +283,7 @@
<v-col cols="12" sm="6" md="5" lg="6"> <v-col cols="12" sm="6" md="5" lg="6">
<v-row> <v-row>
<p <p
class="fontsize-14 black--text float-left cursor-pointer" class="fontsize-14 black--text float-left"
@click="
goToProductDetails(
product.customAttributes,
product.name,
product.productType
)
"
> >
{{ product.name }} {{ product.name }}
</p> </p>

View File

@ -178,8 +178,7 @@ export default {
return with2Decimals; return with2Decimals;
}, },
async addToCart(sku,qty) { async addToCart(sku,qty) {
if (sku) { if (sku) {
debugger
if (this.userAuth) { if (this.userAuth) {
await this.$store await this.$store
.dispatch("userCartProduct/addToCart", { .dispatch("userCartProduct/addToCart", {
@ -195,15 +194,15 @@ export default {
color: "success", color: "success",
show: true, show: true,
timeout: 2000 timeout: 2000
}; };
debugger
this.$store.dispatch("userCartProduct/cartProductList"); this.$store.dispatch("userCartProduct/cartProductList");
this.$emit("actionClose", this.snackbar); this.$emit("actionClose", this.snackbar);
}) })
.catch(() => { .catch((error) => {
console.log("error",error)
this.snackbar = { this.snackbar = {
message: 'Unexpected error while communicating with the cloud', message: error.message,
color: "error", color: "error",
show: true, show: true,
timeout: 2000 timeout: 2000