|
@@ -1,4 +1,3 @@
|
|
|
-import shop from '../api/shop'
|
|
|
import * as types from './mutation-types'
|
|
|
|
|
|
export const addToCart = ({ commit }, product) => {
|
|
@@ -8,19 +7,3 @@ export const addToCart = ({ commit }, product) => {
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-export const checkout = ({ commit, state }, products) => {
|
|
|
- const savedCartItems = [...state.cart.added]
|
|
|
- commit(types.CHECKOUT_REQUEST)
|
|
|
- shop.buyProducts(
|
|
|
- products,
|
|
|
- () => commit(types.CHECKOUT_SUCCESS),
|
|
|
- () => commit(types.CHECKOUT_FAILURE, { savedCartItems })
|
|
|
- )
|
|
|
-}
|
|
|
-
|
|
|
-export const getAllProducts = ({ commit }) => {
|
|
|
- shop.getProducts(products => {
|
|
|
- commit(types.RECEIVE_PRODUCTS, { products })
|
|
|
- })
|
|
|
-}
|