orderiom-api-package 0.3.32 → 0.3.34
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 +1 -1
- package/src/modules/product.js +11 -24
package/package.json
CHANGED
package/src/modules/product.js
CHANGED
|
@@ -38,7 +38,10 @@ const getters = {
|
|
|
38
38
|
|
|
39
39
|
ids.forEach(id=>{
|
|
40
40
|
let filter = state.products.find(i=> i.subcategory_id === id)
|
|
41
|
-
subCategories.push({name: filter.subcategory_name, id: filter.subcategory_id, imagePath: filter.subcategory_image})
|
|
41
|
+
subCategories.push({name: filter.subcategory_name, id: filter.subcategory_id, imagePath: filter.subcategory_image, priority: filter.subcategory_priority})
|
|
42
|
+
subCategories.sort(function(a,b) {
|
|
43
|
+
return a.priority - b.priority;
|
|
44
|
+
});
|
|
42
45
|
})
|
|
43
46
|
|
|
44
47
|
return subCategories
|
|
@@ -234,20 +237,13 @@ const actions = {
|
|
|
234
237
|
getProducts({ commit, state, rootState }, data) {
|
|
235
238
|
commit("setSelectedCategory", data.category);
|
|
236
239
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
return $http.get("api/restaurant/products", {params: {
|
|
246
|
-
categoryId: data.category.id,
|
|
247
|
-
restaurantId: data.restaurantId,
|
|
248
|
-
delivery_time: data.delivery_time || undefined,
|
|
249
|
-
basketId
|
|
250
|
-
}}).then(res => {
|
|
240
|
+
return $http.get("api/restaurant/products", {
|
|
241
|
+
params: {
|
|
242
|
+
categoryId: data.category.id,
|
|
243
|
+
restaurantId: data.restaurantId,
|
|
244
|
+
delivery_time: state.deliveryTime || undefined,
|
|
245
|
+
}
|
|
246
|
+
}).then(res => {
|
|
251
247
|
res.data.data.forEach(productInCategory => {
|
|
252
248
|
productInCategory.quantity = state.ShoppingCart
|
|
253
249
|
.filter(itemInCart => Number(itemInCart.RestaurantProductId) === Number(productInCategory.id))
|
|
@@ -363,14 +359,6 @@ const actions = {
|
|
|
363
359
|
});
|
|
364
360
|
},
|
|
365
361
|
getProductsFromAllCategories({ commit, state, rootState }, {categories = null, restaurantId = null}) {
|
|
366
|
-
let basketId = undefined;
|
|
367
|
-
try{
|
|
368
|
-
basketId = calculateBasketIdParameter(!!rootState.orderiomApiPackage.auth.privateToken, restaurantId);
|
|
369
|
-
} catch(e) {
|
|
370
|
-
console.error(e);
|
|
371
|
-
return { type: 'error', msg: 'Basket not found', data: [] }
|
|
372
|
-
}
|
|
373
|
-
|
|
374
362
|
const list = (categories || state.categories);
|
|
375
363
|
|
|
376
364
|
// TODO: It is recommended to use a new api instead of multiple api calls inside a loop.
|
|
@@ -379,7 +367,6 @@ const actions = {
|
|
|
379
367
|
params: {
|
|
380
368
|
categoryId: category.id,
|
|
381
369
|
restaurantId: restaurantId || restaurantIdEnv,
|
|
382
|
-
basketId
|
|
383
370
|
}
|
|
384
371
|
})
|
|
385
372
|
)).then(resArray => ({
|