redux-clerk2 2.0.16 → 2.0.19
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/CHANGELOG.md +79 -0
- package/lib/actions/BaseAction.js +1 -0
- package/lib/actions/Perform.js +202 -200
- package/package.json +1 -1
- package/src/.DS_Store +0 -0
- package/src/actions/BaseAction.js +1 -0
- package/src/actions/Perform.js +22 -20
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
## 1.0.0
|
|
2
|
+
###### _August 10, 2017_
|
|
3
|
+
|
|
4
|
+
- Convert responseData to Immutable data structure before adding to store ([#51](https://github.com/GetAmbassador/redux-clerk/pull/51))
|
|
5
|
+
|
|
6
|
+
## 1.0.0-rc.4
|
|
7
|
+
###### _May 2, 2017_
|
|
8
|
+
|
|
9
|
+
- Accept responseData in handleSuccess for the update action ([#48](https://github.com/GetAmbassador/redux-clerk/pull/48))
|
|
10
|
+
- Update docs to reflect optional optimism ([#47](https://github.com/GetAmbassador/redux-clerk/pull/47))
|
|
11
|
+
|
|
12
|
+
## 1.0.0-rc.3
|
|
13
|
+
###### _April 10, 2017_
|
|
14
|
+
|
|
15
|
+
- Cast all raw ids to strings ([#44](https://github.com/GetAmbassador/redux-clerk/pull/44))
|
|
16
|
+
- Update selectors to handle optional optimism ([#43](https://github.com/GetAmbassador/redux-clerk/pull/43))
|
|
17
|
+
- Make optimistic updates optional ([#41](https://github.com/GetAmbassador/redux-clerk/pull/41))
|
|
18
|
+
|
|
19
|
+
## 1.0.0-rc.2
|
|
20
|
+
###### _March 23, 2017_
|
|
21
|
+
|
|
22
|
+
- Added pre action hooks ([#38](https://github.com/GetAmbassador/redux-clerk/pull/38))
|
|
23
|
+
|
|
24
|
+
## 1.0.0-rc.1
|
|
25
|
+
###### _March 22, 2017_
|
|
26
|
+
|
|
27
|
+
- Added post action hooks ([#36](https://github.com/GetAmbassador/redux-clerk/pull/36))
|
|
28
|
+
- Rename delete action to remove to avoid reserved word conflicts ([#35](https://github.com/GetAmbassador/redux-clerk/pull/35))
|
|
29
|
+
|
|
30
|
+
## 0.3.0
|
|
31
|
+
###### _March 15, 2017_
|
|
32
|
+
|
|
33
|
+
- Fetch response will now deep merge response data into raw data ([#33](https://github.com/GetAmbassador/redux-clerk/pull/33))
|
|
34
|
+
|
|
35
|
+
## 0.2.8
|
|
36
|
+
###### _February 21, 2017_
|
|
37
|
+
|
|
38
|
+
- Cast uid to int in record selector ([#31](https://github.com/GetAmbassador/redux-clerk/pull/31))
|
|
39
|
+
|
|
40
|
+
## 0.2.7
|
|
41
|
+
###### _February 16, 2017_
|
|
42
|
+
|
|
43
|
+
- Added the get selector ([#29](https://github.com/GetAmbassador/redux-clerk/pull/29))
|
|
44
|
+
|
|
45
|
+
## 0.2.6
|
|
46
|
+
###### _January 11, 2017_
|
|
47
|
+
|
|
48
|
+
- Added the datasetProperty selector ([#27](https://github.com/GetAmbassador/redux-clerk/pull/27))
|
|
49
|
+
|
|
50
|
+
## 0.2.5
|
|
51
|
+
###### _January 3, 2017_
|
|
52
|
+
|
|
53
|
+
- Return Map instead of List for empty dataset ([#25](https://github.com/GetAmbassador/redux-clerk/pull/25))
|
|
54
|
+
- Ensure data is properly converted between actions and reducers ([#24](https://github.com/GetAmbassador/redux-clerk/pull/24))
|
|
55
|
+
|
|
56
|
+
## 0.2.4
|
|
57
|
+
###### _December 15, 2016_
|
|
58
|
+
|
|
59
|
+
- uidField option has been removed for the reducer (it is not longer needed) ([#22](https://github.com/GetAmbassador/redux-clerk/pull/22))
|
|
60
|
+
|
|
61
|
+
## 0.2.3
|
|
62
|
+
###### _December 14, 2016_
|
|
63
|
+
|
|
64
|
+
- Records are now added while updating if not already in state ([#20](https://github.com/GetAmbassador/redux-clerk/pull/20))
|
|
65
|
+
|
|
66
|
+
## 0.2.2
|
|
67
|
+
###### _December 13, 2016_
|
|
68
|
+
|
|
69
|
+
- Added the ability to return fetch response as an object or array ([#18](https://github.com/GetAmbassador/redux-clerk/pull/18))
|
|
70
|
+
|
|
71
|
+
## 0.2.1
|
|
72
|
+
###### _December 7, 2016_
|
|
73
|
+
|
|
74
|
+
- Added the ability to pass additional data with fetch, create and delete actions ([#16](https://github.com/GetAmbassador/redux-clerk/pull/16))
|
|
75
|
+
|
|
76
|
+
## 0.2.0
|
|
77
|
+
###### _December 5, 2016_
|
|
78
|
+
|
|
79
|
+
- Initial Release
|
|
@@ -111,6 +111,7 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
111
111
|
dispatch(action);
|
|
112
112
|
|
|
113
113
|
if (type === 'success' && actionData.options.normalizeResponse) {
|
|
114
|
+
console.log('actionData.options:', actionData.options);
|
|
114
115
|
// DISPATCH RELATED ACTIONS IF WE HAVE normalizationSettings
|
|
115
116
|
if (responseData) {
|
|
116
117
|
if (actionData.normalizationSettings && Array.isArray(actionData.normalizationSettings)) {
|
package/lib/actions/Perform.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
4
|
+
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Perform = undefined;
|
|
7
7
|
|
|
@@ -31,205 +31,207 @@ var uuidv1 = require('uuid/v1');
|
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
33
|
var Perform = exports.Perform = function (_BaseAction) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
34
|
+
_inherits(Perform, _BaseAction);
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Create an instance of the bulk action.
|
|
38
|
+
* @param {Object} config - The configuration for the action.
|
|
39
|
+
*/
|
|
40
|
+
function Perform(config) {
|
|
41
|
+
_classCallCheck(this, Perform);
|
|
42
|
+
|
|
43
|
+
var _this = _possibleConstructorReturn(this, (Perform.__proto__ || Object.getPrototypeOf(Perform)).call(this, 'perform', config));
|
|
44
|
+
|
|
45
|
+
_this.do = function (instance, record) {
|
|
46
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
47
|
+
var _this$config = _this.config,
|
|
48
|
+
uidField = _this$config.uidField,
|
|
49
|
+
performer = _this$config.performer,
|
|
50
|
+
actionSettings = _this$config.actionSettings,
|
|
51
|
+
api = _this$config.api,
|
|
52
|
+
notificationActions = _this$config.notificationActions,
|
|
53
|
+
normalizationSettings = _this$config.normalizationSettings;
|
|
54
|
+
|
|
55
|
+
//console.log('actionSettings', actionSettings);
|
|
56
|
+
//console.log('api', api);
|
|
57
|
+
//console.log('notificationAction', notificationAction);
|
|
58
|
+
|
|
59
|
+
// Extend fetch options
|
|
60
|
+
|
|
61
|
+
options = _extends({}, _this.defaultOptions, options);
|
|
62
|
+
|
|
63
|
+
// Make sure record is an immutable map
|
|
64
|
+
record = _immutable2.default.Iterable.isIterable(record) ? record : _immutable2.default.fromJS(record);
|
|
65
|
+
|
|
66
|
+
// Validate instance key
|
|
67
|
+
_this.validateInstance(instance);
|
|
68
|
+
|
|
69
|
+
/*if(List.isList(record)){
|
|
70
|
+
// ADD uids to new items
|
|
71
|
+
record = record.map(item =>
|
|
72
|
+
item.get(uidField) === undefined ? item.set("tmpid", uuidv1()) : item
|
|
73
|
+
);
|
|
74
|
+
}else{
|
|
75
|
+
record.get(uidField) === undefined ? record.set("tmpid", uuidv1()) : record
|
|
76
|
+
}*/
|
|
77
|
+
|
|
78
|
+
return function (dispatch) {
|
|
79
|
+
|
|
80
|
+
// Create data object to be dispatched with actions
|
|
81
|
+
var isAsync = options.isAsync !== undefined ? options.isAsync : typeof performer === 'function' || actionSettings !== undefined;
|
|
82
|
+
var data = { instance: instance, record: record, uidField: uidField, isAsync: isAsync, options: options, normalizationSettings: normalizationSettings };
|
|
83
|
+
var msguid = uuidv1();
|
|
84
|
+
|
|
85
|
+
// Call BaseAction.start with dispatch and the action data
|
|
86
|
+
_this.start(dispatch, data);
|
|
87
|
+
|
|
88
|
+
//console.log('action bulk:', data);
|
|
89
|
+
|
|
90
|
+
if (actionSettings !== undefined && isAsync) {
|
|
91
|
+
var notify = notificationActions.notify,
|
|
92
|
+
notifyDismiss = notificationActions.notifyDismiss;
|
|
93
|
+
// Extend config options
|
|
94
|
+
|
|
95
|
+
var settings = _extends({}, actionSettings.default, actionSettings.performer);
|
|
96
|
+
//console.log(settings);
|
|
97
|
+
var displayLoading = settings.loading !== undefined && settings.loading !== '' ? true : false;
|
|
98
|
+
var displayNotification = settings.notification !== undefined && settings.notification.type === 'notification' ? true : false;
|
|
99
|
+
var displayMessage = settings.notification !== undefined && !displayNotification ? true : false;
|
|
100
|
+
|
|
101
|
+
if (displayLoading) {
|
|
102
|
+
dispatch(notify({
|
|
103
|
+
id: msguid,
|
|
104
|
+
title: settings.loading !== undefined ? settings.loading : 'Please wait',
|
|
105
|
+
kind: 'loading'
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
//console.log('auto performer action');
|
|
110
|
+
var successHandler = _this.success.bind(_this, dispatch, data);
|
|
111
|
+
var errorHandler = _this.error.bind(_this, dispatch, data);
|
|
112
|
+
|
|
113
|
+
var url = settings.url;
|
|
114
|
+
|
|
115
|
+
var activeProperty = localStorage.activeProperty !== undefined && localStorage.activeProperty !== 'undefined' ? JSON.parse(localStorage.activeProperty) : null;
|
|
116
|
+
var propertycode = activeProperty !== null ? activeProperty.propertycode : null;
|
|
117
|
+
|
|
118
|
+
if (options && options.property_id) {
|
|
119
|
+
var properties = localStorage.properties !== undefined && localStorage.properties !== 'undefined' ? JSON.parse(localStorage.properties) : [];
|
|
120
|
+
var overrideProperty = properties.find(function (property) {
|
|
121
|
+
return property.id === options.property_id;
|
|
122
|
+
});
|
|
123
|
+
if (overrideProperty && overrideProperty.propertycode) {
|
|
124
|
+
propertycode = overrideProperty.propertycode;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (propertycode !== null) {
|
|
129
|
+
url = settings.url.replace(/#@propertycode@#/i, propertycode);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
//console.log(`options`, options);
|
|
133
|
+
|
|
134
|
+
if (options.url) {
|
|
135
|
+
url = url + '/' + options.url;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
//return api.put(url, record.toJSON())
|
|
139
|
+
return api({ method: options.method || 'get', url: url, data: record.toJSON() }).then(function (response) {
|
|
140
|
+
if (displayLoading) {
|
|
141
|
+
dispatch(notifyDismiss(msguid));
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
var message = '';
|
|
145
|
+
|
|
146
|
+
if (response.data.success) {
|
|
147
|
+
successHandler(response.data.data || [], null, response.data.updates || []);
|
|
148
|
+
message = response.data.message;
|
|
149
|
+
|
|
150
|
+
if (settings.notification !== undefined) {
|
|
151
|
+
if (settings.notification.type !== undefined && settings.notification.type === 'notification') {
|
|
152
|
+
dispatch(notify({
|
|
153
|
+
title: settings.notification.title,
|
|
154
|
+
message: settings.notification.message !== undefined ? settings.notification.message : message,
|
|
155
|
+
type: 'notification',
|
|
156
|
+
kind: settings.notification.kind !== undefined ? settings.notification.kind : 'success'
|
|
157
|
+
}));
|
|
158
|
+
} else {
|
|
159
|
+
dispatch(notify({
|
|
160
|
+
title: settings.notification.title !== undefined ? settings.notification.title : message, //response.data.message,
|
|
161
|
+
kind: settings.notification.kind !== undefined ? settings.notification.kind : 'success'
|
|
162
|
+
}));
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
} else {
|
|
166
|
+
errorHandler(response.data.error);
|
|
167
|
+
message = response.data.error.message !== undefined ? response.data.error.message : response.data.error;
|
|
168
|
+
|
|
169
|
+
dispatch(notify({
|
|
170
|
+
title: settings.error.title,
|
|
171
|
+
message: message || settings.error.message,
|
|
172
|
+
type: 'notification',
|
|
173
|
+
kind: settings.error.kind !== undefined ? settings.error.kind : 'error'
|
|
174
|
+
}));
|
|
175
|
+
}
|
|
176
|
+
return response.data;
|
|
177
|
+
}).catch(function (error) {
|
|
178
|
+
if (displayLoading) {
|
|
179
|
+
dispatch(notifyDismiss(msguid));
|
|
180
|
+
}
|
|
181
|
+
errorHandler(error);
|
|
182
|
+
|
|
183
|
+
if (error && error.response && error.response.status && error.response.status !== 401) {
|
|
184
|
+
|
|
185
|
+
if (settings.error.type !== undefined && settings.error.type === 'notification') {
|
|
186
|
+
dispatch(notify({
|
|
187
|
+
title: settings.error.title,
|
|
188
|
+
message: error.response.data.message ? error.response.data.message : settings.error.message !== undefined ? settings.error.message : '',
|
|
189
|
+
type: 'notification',
|
|
190
|
+
kind: settings.error.kind !== undefined ? settings.error.kind : 'error'
|
|
191
|
+
}));
|
|
192
|
+
} else {
|
|
193
|
+
dispatch(notify({
|
|
194
|
+
title: error.response.data.message ? error.response.data.message : settings.error.title !== undefined ? settings.error.title : '',
|
|
195
|
+
kind: settings.error.kind !== undefined ? settings.error.kind : 'error'
|
|
196
|
+
}));
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
} else {
|
|
201
|
+
// If config.performer is provided, call it
|
|
202
|
+
//if(isAsync) {
|
|
203
|
+
// Prepare BaseAction.success and BaseAction.error handlers
|
|
204
|
+
// by currying with dispatch
|
|
205
|
+
var success = _this.success.bind(_this, dispatch, data);
|
|
206
|
+
var error = _this.error.bind(_this, dispatch, data);
|
|
207
|
+
return success(record || []);
|
|
208
|
+
// Call performer
|
|
209
|
+
//return performer(record, success, error);
|
|
210
|
+
//}
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
return _this;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Default options for the fetch action.
|
|
220
|
+
*/
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Generate an action creator with the provided data.
|
|
225
|
+
* @param {Object} record - item being updated.
|
|
226
|
+
*
|
|
227
|
+
* @returns {Function} - Returns the perform action thunk.
|
|
228
|
+
*/
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
return Perform;
|
|
230
232
|
}(_BaseAction3.default);
|
|
231
233
|
|
|
232
234
|
Perform.defaultOptions = {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
235
|
+
appendResponse: true,
|
|
236
|
+
normalizeResponse: false,
|
|
237
|
+
property_id: null };
|
package/package.json
CHANGED
package/src/.DS_Store
ADDED
|
Binary file
|
|
@@ -60,6 +60,7 @@ class BaseAction {
|
|
|
60
60
|
dispatch(action);
|
|
61
61
|
|
|
62
62
|
if (type === 'success' && actionData.options.normalizeResponse) {
|
|
63
|
+
console.log(`actionData.options:`, actionData.options)
|
|
63
64
|
// DISPATCH RELATED ACTIONS IF WE HAVE normalizationSettings
|
|
64
65
|
if (responseData) {
|
|
65
66
|
if(actionData.normalizationSettings && Array.isArray(actionData.normalizationSettings)){
|
package/src/actions/Perform.js
CHANGED
|
@@ -126,30 +126,32 @@ export class Perform extends BaseAction {
|
|
|
126
126
|
successHandler(response.data.data || [], null, response.data.updates || []);
|
|
127
127
|
message = response.data.message;
|
|
128
128
|
|
|
129
|
-
if(
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
129
|
+
if(settings.notification !== undefined ){
|
|
130
|
+
if(settings.notification.type !== undefined && settings.notification.type === 'notification'){
|
|
131
|
+
dispatch(notify({
|
|
132
|
+
title: settings.notification.title,
|
|
133
|
+
message: (settings.notification.message !== undefined)?settings.notification.message:message,
|
|
134
|
+
type: 'notification',
|
|
135
|
+
kind: (settings.notification.kind !== undefined)?settings.notification.kind:'success'
|
|
136
|
+
}));
|
|
137
|
+
}else{
|
|
138
|
+
dispatch(notify({
|
|
139
|
+
title: (settings.notification.title !== undefined)?settings.notification.title:message,//response.data.message,
|
|
140
|
+
kind: (settings.notification.kind !== undefined)?settings.notification.kind:'success'
|
|
141
|
+
}));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
142
144
|
|
|
143
145
|
}else{
|
|
144
146
|
errorHandler(response.data.error);
|
|
145
147
|
message = (response.data.error.message !== undefined)?response.data.error.message:response.data.error;
|
|
146
148
|
|
|
147
149
|
dispatch(notify({
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
title: settings.error.title,
|
|
151
|
+
message: message || settings.error.message,
|
|
152
|
+
type: 'notification',
|
|
153
|
+
kind: (settings.error.kind !== undefined)?settings.error.kind:'error'
|
|
154
|
+
}));
|
|
153
155
|
}
|
|
154
156
|
return response.data;
|
|
155
157
|
})
|
|
@@ -164,13 +166,13 @@ export class Perform extends BaseAction {
|
|
|
164
166
|
if(settings.error.type !== undefined && settings.error.type === 'notification'){
|
|
165
167
|
dispatch(notify({
|
|
166
168
|
title: settings.error.title,
|
|
167
|
-
message: (settings.error.message !== undefined)?settings.error.message:
|
|
169
|
+
message: error.response.data.message ? error.response.data.message : (settings.error.message !== undefined)?settings.error.message:'',
|
|
168
170
|
type: 'notification',
|
|
169
171
|
kind: (settings.error.kind !== undefined)?settings.error.kind:'error'
|
|
170
172
|
}));
|
|
171
173
|
}else{
|
|
172
174
|
dispatch(notify({
|
|
173
|
-
title: (settings.error.title !== undefined)?settings.error.title:
|
|
175
|
+
title: error.response.data.message ? error.response.data.message : (settings.error.title !== undefined)?settings.error.title:'',
|
|
174
176
|
kind: (settings.error.kind !== undefined)?settings.error.kind:'error'
|
|
175
177
|
}));
|
|
176
178
|
}
|