@panneau/core 3.0.14 → 3.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/es/contexts.js +59 -652
- package/es/hooks.js +5 -2
- package/lib/contexts.js +58 -674
- package/lib/hooks.js +5 -2
- package/package.json +22 -24
package/es/hooks.js
CHANGED
|
@@ -164,6 +164,8 @@ var useForm = function useForm() {
|
|
|
164
164
|
withoutPropagation = _opts$withoutPropagat === void 0 ? true : _opts$withoutPropagat,
|
|
165
165
|
_opts$onComplete = opts.onComplete,
|
|
166
166
|
onComplete = _opts$onComplete === void 0 ? null : _opts$onComplete,
|
|
167
|
+
_opts$onError = opts.onError,
|
|
168
|
+
onError = _opts$onError === void 0 ? null : _opts$onError,
|
|
167
169
|
_opts$locales = opts.locales,
|
|
168
170
|
locales = _opts$locales === void 0 ? [] : _opts$locales;
|
|
169
171
|
var _useState = useState(initialValue || providedValue),
|
|
@@ -228,8 +230,6 @@ var useForm = function useForm() {
|
|
|
228
230
|
onChange: onFieldChange
|
|
229
231
|
}, locales);
|
|
230
232
|
}, fieldsKey);
|
|
231
|
-
// console.log('fk', fieldsKey);
|
|
232
|
-
|
|
233
233
|
var csrfToken = useMemo(function () {
|
|
234
234
|
return getCsrfToken();
|
|
235
235
|
}, []);
|
|
@@ -247,6 +247,9 @@ var useForm = function useForm() {
|
|
|
247
247
|
} else {
|
|
248
248
|
setGeneralError(error.message);
|
|
249
249
|
}
|
|
250
|
+
if (onError !== null) {
|
|
251
|
+
onError(error);
|
|
252
|
+
}
|
|
250
253
|
};
|
|
251
254
|
var onSubmitSuccess = function onSubmitSuccess(resp) {
|
|
252
255
|
setRequestState({
|