Commit 8870f784 authored by Artem's avatar Artem

add notification when product added to cart on product page

parent 5a088784
...@@ -6,10 +6,11 @@ function setAddToCardEventListener() { ...@@ -6,10 +6,11 @@ function setAddToCardEventListener() {
.then(function (response) { .then(function (response) {
const cartAmountElem = document.querySelector('.amount-in-cart'); const cartAmountElem = document.querySelector('.amount-in-cart');
cartAmountElem.textContent = response.data; cartAmountElem.textContent = response.data;
toastr.success('Product added to cart');
}) })
.catch(function (error) { .catch(function (error) {
console.log(error); console.log(error);
alert('Sorry, error, we are just learning how to code'); toastr.error('Error, something went wrong');
}); });
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment