orderiom-api-package 0.3.36 → 0.3.38
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 +1 -46
package/package.json
CHANGED
package/src/modules/product.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {commonErrorCallback, calculateBasketIdParameter, updateBasket, restaurantIdEnv, $http} from '../common';
|
|
2
|
+
import Vue from 'vue';
|
|
2
3
|
|
|
3
4
|
const state = () => ({
|
|
4
5
|
selectedTime: null,
|
|
@@ -144,52 +145,6 @@ const mutations = {
|
|
|
144
145
|
};
|
|
145
146
|
const actions = {
|
|
146
147
|
// TODO: note the $http in loop
|
|
147
|
-
// Orderiom api doesn't use this function
|
|
148
|
-
// check whether ordermood is using this function or not
|
|
149
|
-
getCategoriesWithProducts({ commit, dispatch }, restaurantId) {
|
|
150
|
-
return $http.get("api/restaurant/category", {
|
|
151
|
-
params: {
|
|
152
|
-
restaurantId: restaurantId
|
|
153
|
-
}
|
|
154
|
-
}).then(res => {
|
|
155
|
-
let categories = res.data.data
|
|
156
|
-
commit("setSelectedCategory", categories[0]);
|
|
157
|
-
|
|
158
|
-
$http.get("api/restaurant/category", {
|
|
159
|
-
params: {
|
|
160
|
-
restaurantId: restaurantId,
|
|
161
|
-
extra: 1
|
|
162
|
-
}
|
|
163
|
-
}).then(res => {
|
|
164
|
-
if (res.data.data.length) {
|
|
165
|
-
categories = [...categories, ...res.data.data];
|
|
166
|
-
categories.forEach(cat => {
|
|
167
|
-
dispatch("getProducts", {
|
|
168
|
-
category: cat,
|
|
169
|
-
restaurantId: restaurantId,
|
|
170
|
-
}).then(res => {
|
|
171
|
-
cat.products = res.data;
|
|
172
|
-
cat.products.push();
|
|
173
|
-
});
|
|
174
|
-
});
|
|
175
|
-
commit('setCategories', categories);
|
|
176
|
-
} else {
|
|
177
|
-
commit('setCategories', categories);
|
|
178
|
-
categories.forEach(cat => {
|
|
179
|
-
dispatch("getProducts", {
|
|
180
|
-
category: cat,
|
|
181
|
-
restaurantId: restaurantId,
|
|
182
|
-
}).then(res => {
|
|
183
|
-
cat.products = res.data;
|
|
184
|
-
cat.products.push();
|
|
185
|
-
});
|
|
186
|
-
})
|
|
187
|
-
}
|
|
188
|
-
})
|
|
189
|
-
}).catch(
|
|
190
|
-
commonErrorCallback()
|
|
191
|
-
);
|
|
192
|
-
},
|
|
193
148
|
getCategories({ commit, dispatch }, restaurantId) {
|
|
194
149
|
return $http
|
|
195
150
|
.get("api/restaurant/category", { params: { restaurantId: restaurantId } })
|