orderiom-api-package 0.2.27 → 0.2.28

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": "orderiom-api-package",
3
- "version": "0.2.27",
3
+ "version": "0.2.28",
4
4
  "description": "this package will install all neccessary api calls for every orderiom restaurant",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -375,7 +375,35 @@ const actions = {
375
375
  }
376
376
  });
377
377
  },
378
+ searchOnProducts({ commit }, data) {
379
+ return axios.get('api/restaurant/product/search', {
380
+ params: {
381
+ query: data.query,
382
+ restaurantId: data.restaurantId
383
+ }
384
+ }).then((result) => {
385
+ commit('setProductPackage', result.data.data)
386
+ }).catch((error) => {
387
+ if (error.response) {
388
+ if (error.response.status == 422) {
389
+ return {
390
+ type: 'error',
391
+ msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
392
+
393
+ }
394
+ }
395
+ if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
396
+
397
+ return {
398
+ type: 'error',
399
+ msg: error.response.data.message.body
400
+
401
+ }
402
+ }
378
403
 
404
+ }
405
+ });
406
+ }
379
407
  };
380
408
 
381
409
  export default {