orderiom-api-package 0.4.41 → 0.4.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orderiom-api-package",
3
- "version": "0.4.41",
3
+ "version": "0.4.43",
4
4
  "description": "This package will install all necessary API calls for every orderiom restaurant",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
package/src/common.js CHANGED
@@ -128,7 +128,14 @@ axios.interceptors.request.use(config => {
128
128
  return Promise.reject(error);
129
129
  });
130
130
  axios.interceptors.response.use(
131
- res => res,
131
+ res => {
132
+ return {
133
+ type: 'success',
134
+ msg: '',
135
+ status: res.status,
136
+ data: res.data
137
+ }
138
+ },
132
139
  error => {
133
140
  if (
134
141
  error.response &&
@@ -913,16 +913,20 @@ const actions = {
913
913
  },
914
914
  addReview({commit}, data) {
915
915
  commit('setSubmittingReview', true);
916
- return $http.post("testimonials/create", data).then(() => ({
917
- type: 'success',
918
- msg: '',
919
- })).catch(
920
- commonErrorCallback()
921
- ).finally(() => {
922
- commit('setSubmittingReview', true);
923
- });
916
+ return $http.post("api/testimonials/create", data)
917
+ .then(res => res)
918
+ .catch(commonErrorCallback())
919
+ .finally(() => {
920
+ commit('setSubmittingReview', false);
921
+ });
922
+ },
923
+ getTestimonials({commit}, id) {
924
+ const idToShow = id ? '/show?testimonialId' + id : ''
925
+ return $http.get(`api/testimonials${idToShow}`)
926
+ .then(res => res)
927
+ .catch(commonErrorCallback())
924
928
  },
925
- addVoucher({ rootState, dispatch }, data) {
929
+ addVoucher({ rootState, dispatch }, data) {
926
930
  let basketId = undefined;
927
931
  try {
928
932
  basketId = calculateBasketIdParameter(