@viur/shop-components 0.9.0 → 0.9.1

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.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "Frontend Vue components for the shop module of ViUR",
5
5
  "repository": {
6
6
  "type": "git",
package/src/Shop.vue CHANGED
@@ -120,12 +120,12 @@ onBeforeMount(()=>{
120
120
  }
121
121
 
122
122
  shopStore.state.moduleName= props.modulename
123
- fetchCart()
124
123
  shopStore.fetchMetaData()
125
124
  const params = useUrlSearchParams('hash')
126
125
  if (Object.keys(params).includes('order')){
127
126
  shopStore.state.orderKey = params['order']
128
127
  fetchOrder(shopStore.state.orderKey).then(()=>{
128
+ fetchCart(); // load after cartKey has been loaded from order
129
129
  shopStore.state.orderReady = true
130
130
  // navigate to order state
131
131
  if(shopStore.state.order?.['is_ordered']){
@@ -135,6 +135,7 @@ onBeforeMount(()=>{
135
135
  }
136
136
  })
137
137
  }else{
138
+ fetchCart()
138
139
  shopStore.state.orderReady = true
139
140
  }
140
141
 
@@ -39,18 +39,18 @@ export function useCart() {
39
39
  //first fetch root then fetchItems for this root
40
40
  state.isLoading = true;
41
41
 
42
- if (shopStore.state.order != null && shopStore.order?.cart?.key.length) {
43
- shopStore.state.cartRoot = {};
44
- shopStore.state.cartRoot = shopStore.state.order.cart;
42
+ if (shopStore.state.order != null && shopStore.state.order?.cart?.dest.key) {
43
+ // shopStore.state.cartRoot = {};
44
+ shopStore.state.cartRoot = shopStore.state.order.cart.dest;
45
45
 
46
- return fetchCartItems(shopStore.state.order.cart.key).then(() => {
46
+ return fetchCartItems(shopStore.state.cartRoot["key"]).then(() => { // TODO: duplicate code
47
47
  state.isLoading = false;
48
48
  shopStore.state.cartReady = true;
49
49
  });
50
50
  }
51
51
  return fetchCartRoot().then(() => {
52
52
  if (!shopStore.state.cartRoot?.["key"]) return 0;
53
- fetchCartItems(shopStore.state.cartRoot["key"]).then(() => {
53
+ fetchCartItems(shopStore.state.cartRoot["key"]).then(() => { // TODO: duplicate code
54
54
  state.isLoading = false;
55
55
  shopStore.state.cartReady = true;
56
56
  });