Last active
July 30, 2019 12:23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addToCart() { | |
this.storage.get(`product_${this.product.id}`).then(async data => { | |
if (data) { | |
const toast = await this.toast.create({ | |
message: 'Item already in Cart', | |
duration: 2000 | |
}); | |
toast.present(); | |
} else { | |
const toast = await this.toast.create({ | |
message: 'Added to Cart', | |
duration: 2000 | |
}); | |
toast.present(); | |
this.storage | |
.set(`product_${this.product.id}`, JSON.stringify(this.product)) | |
.then(() => { | |
this.fun.updateCartBadge(); | |
}); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment