orderiom-api-package 0.2.42 → 0.2.43
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/restaurant.js +38 -0
package/package.json
CHANGED
|
@@ -13,6 +13,7 @@ const state = () => ({
|
|
|
13
13
|
testimonials: [],
|
|
14
14
|
fetchingRestaurantInfo: false,
|
|
15
15
|
fetchingBlogs: false,
|
|
16
|
+
reservedTables:[]
|
|
16
17
|
});
|
|
17
18
|
|
|
18
19
|
const mutations = {
|
|
@@ -31,6 +32,9 @@ const mutations = {
|
|
|
31
32
|
setTables(state, tables) {
|
|
32
33
|
state.tables = tables
|
|
33
34
|
},
|
|
35
|
+
setReservedTables(state, reservedTables) {
|
|
36
|
+
state.reservedTables = reservedTables
|
|
37
|
+
},
|
|
34
38
|
setBlogs(state, blogs) {
|
|
35
39
|
state.blogs = blogs
|
|
36
40
|
},
|
|
@@ -246,6 +250,40 @@ const actions = {
|
|
|
246
250
|
}
|
|
247
251
|
});
|
|
248
252
|
},
|
|
253
|
+
addReservedTables({ commit }, data) {
|
|
254
|
+
return axios
|
|
255
|
+
.post("api/restaurant/reserve-table", {
|
|
256
|
+
restaurantId: restaurantId,
|
|
257
|
+
tableInfo: data.tableInfo,
|
|
258
|
+
}).then((result) => {
|
|
259
|
+
commit('setReservedTables', result.data.data);
|
|
260
|
+
return {
|
|
261
|
+
type: 'success',
|
|
262
|
+
msg: ''
|
|
263
|
+
}
|
|
264
|
+
}).catch((error) => {
|
|
265
|
+
if(!error.response){
|
|
266
|
+
return {
|
|
267
|
+
type: 'error',
|
|
268
|
+
msg: 'There was an error in adding reserved tables',
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
const status = error.response.status;
|
|
272
|
+
if (status === 422) {
|
|
273
|
+
return {
|
|
274
|
+
type: 'error',
|
|
275
|
+
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
if ([401, 403, 404, 400].includes(status)) {
|
|
279
|
+
return {
|
|
280
|
+
type: 'error',
|
|
281
|
+
msg: error.response.data.message.body,
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
});
|
|
286
|
+
},
|
|
249
287
|
getBlogs({ commit }, restaurantId) {
|
|
250
288
|
return axios.get('api/blogs', {
|
|
251
289
|
params: restaurantId
|