summit-registration-lite 2.0.17 → 2.0.18

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.
Files changed (2) hide show
  1. package/dist/index.js +41 -25
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -98,7 +98,7 @@ class LawPayProvider {
98
98
  userProfile,
99
99
  access_token,
100
100
  apiBaseUrl,
101
- dispatch
101
+ dispatch: _dispatch
102
102
  }) {
103
103
  _defineProperty(this, "payTicket", ({
104
104
  token
@@ -107,19 +107,27 @@ class LawPayProvider {
107
107
 
108
108
  // Pay using affinity lawpay
109
109
  const errorHandler = (err, res) => (dispatch, state) => {
110
- if (res && res.statusCode === 404) {
111
- const msg = res.body.message;
112
- external_sweetalert2_default().fire("Validation Error", msg, "warning");
113
- return;
114
- }
110
+ let code = err.status;
115
111
 
116
- if (res && res.statusCode === 500) {
117
- const msg = res.body.message;
118
- external_sweetalert2_default().fire("Server Error", msg, "error");
119
- return;
120
- }
112
+ switch (code) {
113
+ case 404:
114
+ {
115
+ let msg = res.body.message;
116
+ external_sweetalert2_default().fire("Validation Error", msg, "warning");
117
+ }
118
+ break;
119
+
120
+ case 500:
121
+ {
122
+ let msg = res.body.message;
123
+ external_sweetalert2_default().fire("Validation Error", msg, "warning");
124
+ }
125
+ break;
121
126
 
122
- return (0,actions_namespaceObject.authErrorHandler)(err, res);
127
+ default:
128
+ (0,actions_namespaceObject.authErrorHandler)(err, res)(dispatch, state);
129
+ break;
130
+ }
123
131
  };
124
132
 
125
133
  let params = {
@@ -172,7 +180,7 @@ class LawPayProvider {
172
180
  this.userProfile = userProfile;
173
181
  this.access_token = access_token;
174
182
  this.apiBaseUrl = apiBaseUrl;
175
- this.dispatch = dispatch;
183
+ this.dispatch = _dispatch;
176
184
  }
177
185
 
178
186
  }
@@ -200,19 +208,27 @@ class StripeProvider {
200
208
  var _this$userProfile, _this$userProfile2, _this$userProfile3, _this$userProfile4, _this$userProfile5;
201
209
 
202
210
  const errorHandler = (err, res) => (dispatch, state) => {
203
- if (res && res.statusCode === 404) {
204
- const msg = res.body.message;
205
- external_sweetalert2_default().fire("Validation Error", msg, "warning");
206
- return;
207
- }
211
+ let code = err.status;
208
212
 
209
- if (res && res.statusCode === 500) {
210
- const msg = res.body.message;
211
- external_sweetalert2_default().fire("Server Error", msg, "error");
212
- return;
213
- }
213
+ switch (code) {
214
+ case 404:
215
+ {
216
+ let msg = res.body.message;
217
+ external_sweetalert2_default().fire("Validation Error", msg, "warning");
218
+ }
219
+ break;
214
220
 
215
- return (0,actions_namespaceObject.authErrorHandler)(err, res);
221
+ case 500:
222
+ {
223
+ let msg = res.body.message;
224
+ external_sweetalert2_default().fire("Validation Error", msg, "warning");
225
+ }
226
+ break;
227
+
228
+ default:
229
+ (0,actions_namespaceObject.authErrorHandler)(err, res)(dispatch, state);
230
+ break;
231
+ }
216
232
  };
217
233
 
218
234
  let params = {
@@ -470,7 +486,7 @@ const reserveTicket = ({
470
486
  return;
471
487
  }
472
488
 
473
- return (0,actions_namespaceObject.authErrorHandler)(err, res);
489
+ return (0,actions_namespaceObject.authErrorHandler)(err, res)(dispatch, state);
474
490
  };
475
491
 
476
492
  return (0,actions_namespaceObject.postRequest)((0,actions_namespaceObject.createAction)(CREATE_RESERVATION), (0,actions_namespaceObject.createAction)(CREATE_RESERVATION_SUCCESS), `${apiBaseUrl}/api/v1/summits/${summitId}/orders/reserve`, normalizedEntity, errorHandler // entity
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "summit-registration-lite",
3
- "version": "2.0.17",
3
+ "version": "2.0.18",
4
4
  "description": "Summit Registration Lite",
5
5
  "main": "index.js",
6
6
  "scripts": {