File: app/components/test-shopping-cart/store/getters.js

Recommend this page to a friend!
  Classes of Sergey Beskorovayniy   Vuex Examples   app/components/test-shopping-cart/store/getters.js   Download  
File: app/components/test-shopping-cart/store/getters.js
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Vuex Examples
Example apps using Vuex state management pattern
Author: By
Last change: Update of app/components/test-shopping-cart/store/getters.js
Date: 2 years ago
Size: 763 bytes
 

Contents

Class file image Download
define([], function () { var checkoutStatus = function (state) { return state.cart.checkoutStatus; }; var allProducts = function (state) { return state.products.all; }; var cartProducts = function (state) { return state.cart.added.map(function (cartProduct) { var findProduct = _.find(state.products.all, function (p) { return p.id === cartProduct.id; }); return { title: findProduct.title, price: findProduct.price, quantity: cartProduct.quantity }; }); }; return { checkoutStatus: checkoutStatus, allProducts: allProducts, cartProducts: cartProducts }; });