@viur/shop-components 0.0.1-dev.16 → 0.0.1-dev.18

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viur/shop-components",
3
- "version": "0.0.1-dev.16",
3
+ "version": "0.0.1-dev.18",
4
4
  "description": "Frontend Vue components for the shop module of ViUR",
5
5
  "repository": {
6
6
  "type": "git",
@@ -3,7 +3,7 @@
3
3
  </template>
4
4
 
5
5
  <script setup>
6
- import { onBeforeMount, reactive, shallowRef } from "vue";
6
+ import { onBeforeMount, reactive, shallowRef, ref } from "vue";
7
7
  import { ListRequest } from "@viur/vue-utils";
8
8
 
9
9
  import CartView from "../../cart/CartView.vue";
@@ -17,14 +17,16 @@ import { useCartStore } from "../../../stores/cart";
17
17
 
18
18
  const cartStore = useCartStore();
19
19
 
20
+ const rootNode = ref(null);
20
21
  const state = reactive({
22
+ rootNode: {},
21
23
  tabs: {
22
24
  cart: {
23
25
  component: shallowRef(CartView),
24
26
  props: {
25
27
  sidebar: true,
26
28
  mode: "basket",
27
- cartKey: cartStore.state.basketRootNode.key,
29
+ cartKey: rootNode.value.key,
28
30
  }, // cartKey (on initial call has to be a root node) is a required prop, make sure that cartStore.init() is called before cart is mounted
29
31
  displayName: "Warenkorb",
30
32
  icon: { name: "cart", library: "hsk" },
@@ -101,5 +103,9 @@ function handleTabs(e) {
101
103
  onBeforeMount(async () => {
102
104
  await cartStore.init();
103
105
  await cartStore.getAdressStructure();
106
+
107
+ console.log("debug init exampleusage :", cartStore.state.basketRootNode);
108
+
109
+ rootNode.value = cartStore.state.basketRootNode.key;
104
110
  });
105
111
  </script>
@@ -25,9 +25,8 @@ export const useCartStore = defineStore("cartstore", () => {
25
25
  }
26
26
 
27
27
  async function getChildren(parentKey) {
28
- console.log("debug getChildren parentKey: ", parentKey)
29
28
  let resp = await shopClient.cart_list({ cart_key: parentKey });
30
- console.log("debug getChildren: ", resp)
29
+
31
30
  return resp
32
31
  }
33
32