Advertisement
Guest User

Untitled

a guest
Apr 4th, 2020
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. like(context) {
  2.       const { productId } = context.params;
  3.  
  4.       models.products
  5.         .get(productId)
  6.         .then((response) => {
  7.           const product = docModifier(response);
  8.           product.likes = +product.likes + 1;
  9.  
  10.           models.products.put(productId, product).then((response) => {
  11.             context.redirect(`#/products/details/${productId}`);
  12.           });
  13.         })
  14.         .catch((error) => console.error(error));
  15.     },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement