@bluemarble/bm-components 1.9.1 → 1.9.2

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/dist/index.js CHANGED
@@ -4209,44 +4209,50 @@ function useFormHelper() {
4209
4209
  const { createAlert } = alertProps;
4210
4210
  const { setLoading } = loadingProps;
4211
4211
  const sourceRef = _react.useRef.call(void 0, new AbortController());
4212
- const onSubmitWrapper = (fn, { name }) => {
4213
- return (fields, methods) => __async(this, null, function* () {
4214
- const LOADING_NAME = name;
4215
- setLoading(LOADING_NAME);
4216
- try {
4217
- yield fn(fields, methods);
4218
- } catch (error) {
4219
- errorHandler(error, methods.setErrors);
4220
- } finally {
4221
- setLoading(LOADING_NAME, true);
4222
- }
4223
- });
4224
- };
4225
- const onRequestWrapper = (fn, { name }) => {
4226
- return (...params) => __async(this, null, function* () {
4227
- const LOADING_NAME = name;
4228
- setLoading(LOADING_NAME);
4229
- api.interceptors.request.use(
4230
- (config) => {
4231
- if (!config.signal && sourceRef.current && config.method === "get") {
4232
- config.signal = sourceRef.current.signal;
4212
+ const onSubmitWrapper = _react.useCallback.call(void 0,
4213
+ (fn, { name }) => {
4214
+ return (fields, methods) => __async(this, null, function* () {
4215
+ const LOADING_NAME = name;
4216
+ setLoading(LOADING_NAME);
4217
+ try {
4218
+ yield fn(fields, methods);
4219
+ } catch (error) {
4220
+ errorHandler(error, methods.setErrors);
4221
+ } finally {
4222
+ setLoading(LOADING_NAME, true);
4223
+ }
4224
+ });
4225
+ },
4226
+ [setLoading]
4227
+ );
4228
+ const onRequestWrapper = _react.useCallback.call(void 0,
4229
+ (fn, { name }) => {
4230
+ return (...params) => __async(this, null, function* () {
4231
+ const LOADING_NAME = name;
4232
+ setLoading(LOADING_NAME);
4233
+ api.interceptors.request.use(
4234
+ (config) => {
4235
+ if (!config.signal && sourceRef.current && config.method === "get") {
4236
+ config.signal = sourceRef.current.signal;
4237
+ }
4238
+ return config;
4239
+ },
4240
+ (error) => {
4241
+ return Promise.reject(error);
4233
4242
  }
4234
- return config;
4235
- },
4236
- (error) => {
4237
- return Promise.reject(error);
4243
+ );
4244
+ try {
4245
+ const response = yield fn(...params);
4246
+ return response;
4247
+ } catch (error) {
4248
+ errorHandler(error);
4249
+ } finally {
4250
+ setLoading(LOADING_NAME, true);
4238
4251
  }
4239
- );
4240
- try {
4241
- const response = yield fn(...params);
4242
- return response;
4243
- } catch (error) {
4244
- errorHandler(error);
4245
- } finally {
4246
- setLoading(LOADING_NAME, true);
4247
- }
4248
- });
4249
- };
4252
+ });
4253
+ },
4254
+ [setLoading, api]
4255
+ );
4250
4256
  const errorHandler = _react.useCallback.call(void 0,
4251
4257
  (error, callback) => {
4252
4258
  if ((error == null ? void 0 : error.message) === "cancel.navigation")