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.
- package/lib/actions/Create.js +13 -13
- package/package.json +1 -1
- package/src/actions/Create.js +34 -80
- package/src/actions/Update.js +1 -1
package/lib/actions/Create.js
CHANGED
|
@@ -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 ===
|
|
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:
|
|
149
|
-
kind: settings.notification.kind !== undefined ? settings.notification.kind :
|
|
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 :
|
|
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:
|
|
166
|
-
kind: settings.error.kind !== undefined ? settings.error.kind :
|
|
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
|
-
|
|
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 :
|
|
181
|
-
type:
|
|
182
|
-
kind: settings.error.kind !== undefined ? settings.error.kind :
|
|
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 :
|
|
187
|
-
kind: settings.error.kind !== undefined ? settings.error.kind :
|
|
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
package/src/actions/Create.js
CHANGED
|
@@ -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
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
:
|
|
161
|
-
|
|
162
|
-
|
|
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
|
-
|
|
187
|
-
|
|
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:
|
|
195
|
-
kind:
|
|
196
|
-
|
|
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
|
-
|
|
212
|
-
|
|
213
|
-
|
|
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
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
settings.error.
|
|
225
|
-
|
|
226
|
-
|
|
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 {
|