redux-clerk2 2.0.15 → 2.0.16

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.
@@ -137,21 +137,20 @@ var Create = exports.Create = function (_BaseAction) {
137
137
 
138
138
  if (response.data.success) {
139
139
  successHandler(response.data.data || [], null, response.data.updates || []);
140
-
141
140
  message = response.data.message;
142
141
 
143
142
  if (settings.notification !== undefined) {
144
- if (settings.notification.type !== undefined && settings.notification.type === "notification") {
143
+ if (settings.notification.type !== undefined && settings.notification.type === 'notification') {
145
144
  dispatch(notify({
146
145
  title: settings.notification.title,
147
146
  message: settings.notification.message !== undefined ? settings.notification.message : message,
148
- type: "notification",
149
- kind: settings.notification.kind !== undefined ? settings.notification.kind : "success"
147
+ type: 'notification',
148
+ kind: settings.notification.kind !== undefined ? settings.notification.kind : 'success'
150
149
  }));
151
150
  } else {
152
151
  dispatch(notify({
153
152
  title: settings.notification.title !== undefined ? settings.notification.title : message, //response.data.message,
154
- kind: settings.notification.kind !== undefined ? settings.notification.kind : "success"
153
+ kind: settings.notification.kind !== undefined ? settings.notification.kind : 'success'
155
154
  }));
156
155
  }
157
156
  }
@@ -162,8 +161,8 @@ var Create = exports.Create = function (_BaseAction) {
162
161
  dispatch(notify({
163
162
  title: settings.error.title,
164
163
  message: message || settings.error.message,
165
- type: "notification",
166
- kind: settings.error.kind !== undefined ? settings.error.kind : "error"
164
+ type: 'notification',
165
+ kind: settings.error.kind !== undefined ? settings.error.kind : 'error'
167
166
  }));
168
167
  }
169
168
  return response.data;
@@ -174,17 +173,18 @@ var Create = exports.Create = function (_BaseAction) {
174
173
  errorHandler(error);
175
174
 
176
175
  if (error && error.response && error.response.status && error.response.status !== 401) {
177
- if (settings.error.type !== undefined && settings.error.type === "notification") {
176
+
177
+ if (settings.error.type !== undefined && settings.error.type === 'notification') {
178
178
  dispatch(notify({
179
179
  title: settings.error.title,
180
- message: settings.error.message !== undefined ? settings.error.message : error.response.data.message,
181
- type: "notification",
182
- kind: settings.error.kind !== undefined ? settings.error.kind : "error"
180
+ message: error.response.data.message ? error.response.data.message : settings.error.message !== undefined ? settings.error.message : '',
181
+ type: 'notification',
182
+ kind: settings.error.kind !== undefined ? settings.error.kind : 'error'
183
183
  }));
184
184
  } else {
185
185
  dispatch(notify({
186
- title: settings.error.title !== undefined ? settings.error.title : error.response.data.message,
187
- kind: settings.error.kind !== undefined ? settings.error.kind : "error"
186
+ title: error.response.data.message ? error.response.data.message : settings.error.title !== undefined ? settings.error.title : '',
187
+ kind: settings.error.kind !== undefined ? settings.error.kind : 'error'
188
188
  }));
189
189
  }
190
190
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "redux-clerk2",
3
- "version": "2.0.15",
3
+ "version": "2.0.16",
4
4
  "description": "Redux Clerk handles the async CRUD in your Redux App.",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -143,61 +143,33 @@ export class Create extends BaseAction {
143
143
 
144
144
  if (response.data.success) {
145
145
  successHandler(response.data.data || [], null, response.data.updates || []);
146
-
147
146
  message = response.data.message;
148
-
149
- if (settings.notification !== undefined) {
150
- if (
151
- settings.notification.type !== undefined &&
152
- settings.notification.type === "notification"
153
- ) {
154
- dispatch(
155
- notify({
156
- title: settings.notification.title,
157
- message:
158
- settings.notification.message !== undefined
159
- ? settings.notification.message
160
- : message,
161
- type: "notification",
162
- kind:
163
- settings.notification.kind !== undefined
164
- ? settings.notification.kind
165
- : "success"
166
- })
167
- );
168
- } else {
169
- dispatch(
170
- notify({
171
- title:
172
- settings.notification.title !== undefined
173
- ? settings.notification.title
174
- : message, //response.data.message,
175
- kind:
176
- settings.notification.kind !== undefined
177
- ? settings.notification.kind
178
- : "success"
179
- })
180
- );
181
- }
147
+
148
+ if(settings.notification !== undefined ){
149
+ if(settings.notification.type !== undefined && settings.notification.type === 'notification'){
150
+ dispatch(notify({
151
+ title: settings.notification.title,
152
+ message: (settings.notification.message !== undefined)?settings.notification.message:message,
153
+ type: 'notification',
154
+ kind: (settings.notification.kind !== undefined)?settings.notification.kind:'success'
155
+ }));
156
+ }else{
157
+ dispatch(notify({
158
+ title: (settings.notification.title !== undefined)?settings.notification.title:message,//response.data.message,
159
+ kind: (settings.notification.kind !== undefined)?settings.notification.kind:'success'
160
+ }));
161
+ }
182
162
  }
183
163
  } else {
184
164
  errorHandler(response.data.error);
185
- message =
186
- response.data.error.message !== undefined
187
- ? response.data.error.message
188
- : response.data.error;
189
-
190
- dispatch(
191
- notify({
165
+ message = (response.data.error.message !== undefined) ? response.data.error.message : response.data.error;
166
+
167
+ dispatch(notify({
192
168
  title: settings.error.title,
193
169
  message: message || settings.error.message,
194
- type: "notification",
195
- kind:
196
- settings.error.kind !== undefined
197
- ? settings.error.kind
198
- : "error"
199
- })
200
- );
170
+ type: 'notification',
171
+ kind: (settings.error.kind !== undefined)?settings.error.kind:'error'
172
+ }));
201
173
  }
202
174
  return response.data;
203
175
  })
@@ -208,39 +180,21 @@ export class Create extends BaseAction {
208
180
  errorHandler(error);
209
181
 
210
182
  if(error && error.response && error.response.status && error.response.status !== 401 ){
211
- if (
212
- settings.error.type !== undefined &&
213
- settings.error.type === "notification"
214
- ) {
215
- dispatch(
216
- notify({
183
+
184
+ if(settings.error.type !== undefined && settings.error.type === 'notification'){
185
+ dispatch(notify({
217
186
  title: settings.error.title,
218
- message:
219
- settings.error.message !== undefined
220
- ? settings.error.message
221
- : error.response.data.message,
222
- type: "notification",
223
- kind:
224
- settings.error.kind !== undefined
225
- ? settings.error.kind
226
- : "error"
227
- })
228
- );
229
- } else {
230
- dispatch(
231
- notify({
232
- title:
233
- settings.error.title !== undefined
234
- ? settings.error.title
235
- : error.response.data.message,
236
- kind:
237
- settings.error.kind !== undefined
238
- ? settings.error.kind
239
- : "error"
240
- })
241
- );
242
- }
187
+ message: error.response.data.message ? error.response.data.message : (settings.error.message !== undefined)?settings.error.message:'',
188
+ type: 'notification',
189
+ kind: (settings.error.kind !== undefined)?settings.error.kind:'error'
190
+ }));
191
+ }else{
192
+ dispatch(notify({
193
+ title: error.response.data.message ? error.response.data.message : (settings.error.title !== undefined)?settings.error.title:'',
194
+ kind: (settings.error.kind !== undefined)?settings.error.kind:'error'
195
+ }));
243
196
  }
197
+ }
244
198
  })
245
199
  );
246
200
  } else {
@@ -153,7 +153,7 @@ export class Update extends BaseAction {
153
153
  kind: (settings.error.kind !== undefined)?settings.error.kind:'error'
154
154
  }));
155
155
  }
156
- }
156
+ }
157
157
  });
158
158
 
159
159
  }else{