@viur/shop-components 0.0.1-dev.8 → 0.0.1-dev.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/stores/cart.js +12 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viur/shop-components",
3
- "version": "0.0.1-dev.8",
3
+ "version": "0.0.1-dev.9",
4
4
  "description": "Frontend Vue components for the shop module of ViUR",
5
5
  "repository": {
6
6
  "type": "git",
@@ -5,9 +5,10 @@ import { ViURShopClient } from "@viur/viur-shop-client";
5
5
 
6
6
  export const useCartStore = defineStore("cartstore", () => {
7
7
  const shopClient = new ViURShopClient({
8
- host_url: window.location.origin === "http://localhost:8081"
9
- ? "http://localhost:8080"
10
- : window.location.origin,
8
+ host_url:
9
+ window.location.origin === "http://localhost:8081"
10
+ ? "http://localhost:8080"
11
+ : window.location.origin,
11
12
  });
12
13
 
13
14
  const state = reactive({
@@ -23,10 +24,10 @@ export const useCartStore = defineStore("cartstore", () => {
23
24
  async function getCarts() {
24
25
  let carts = await shopClient.cart_list();
25
26
 
26
- console.log("cartStore.init() carts", carts)
27
+ console.log("cartStore.init() carts", carts);
27
28
 
28
29
  carts.forEach(async (cart) => {
29
- console.log("cartStore.init().forEach cart", cart)
30
+ console.log("cartStore.init().forEach cart", cart);
30
31
 
31
32
  state.carts[cart.key] = {};
32
33
  state.carts[cart.key].info = cart;
@@ -38,10 +39,10 @@ export const useCartStore = defineStore("cartstore", () => {
38
39
  }
39
40
 
40
41
  async function getCartItems(cartKey) {
41
- let cartItems = await shopClient.cart_list({ cart_key: cartKey });
42
- console.log("cartStore.init() cartItems", cartItems)
43
-
44
- state.carts[cartKey].items = cartItems;
42
+ shopClient.cart_list({ cart_key: cartKey }).then((resp) => {
43
+ console.log("cartStore.init() cartItems", resp);
44
+ state.carts[cartKey].items = resp;
45
+ });
45
46
  }
46
47
 
47
48
  async function addToCart(articleKey, cartKey) {
@@ -93,8 +94,8 @@ export const useCartStore = defineStore("cartstore", () => {
93
94
  }
94
95
 
95
96
  async function getAdressStructure() {
96
- let addSkel = await shopClient.address_structure()
97
- state.structure.address = addSkel.addSkel
97
+ let addSkel = await shopClient.address_structure();
98
+ state.structure.address = addSkel.addSkel;
98
99
 
99
100
  console.log("adress add", state.structure.address);
100
101