@evlop/commons 1.0.230 → 1.0.231

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,6 +5,6 @@ import { Action } from './useActionable';
5
5
  * @returns function
6
6
  */
7
7
  export declare const useAction: (action?: Action) => (event: any) => any;
8
- export declare const useAsyncAction: (action?: Action) => (boolean | ((event: any) => Promise<void>))[];
8
+ export declare const useAsyncAction: (action?: Action) => (boolean | ((event: any) => Promise<any>))[];
9
9
  export default useAction;
10
10
  //# sourceMappingURL=useAction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useAction.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAction.tsx"],"names":[],"mappings":"AACA,OAAsB,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGxD;;;;GAIG;AAEH,eAAO,MAAM,SAAS,YAAa,MAAM,wBAIxC,CAAC;AAEF,eAAO,MAAM,cAAc,YAAa,MAAM,yBAMK,GAAG,sBAYrD,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"useAction.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAction.tsx"],"names":[],"mappings":"AACA,OAAsB,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGxD;;;;GAIG;AAEH,eAAO,MAAM,SAAS,YAAa,MAAM,wBAIxC,CAAC;AAEF,eAAO,MAAM,cAAc,YAAa,MAAM,yBAMK,GAAG,qBAcrD,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -23,7 +23,7 @@ const useActionable_1 = __importDefault(require("./useActionable"));
23
23
  */
24
24
  const useAction = (action) => {
25
25
  const createActionHandeller = useActionable_1.default();
26
- return react_1.useMemo(() => action ? createActionHandeller(action) : null, [action, createActionHandeller]);
26
+ return react_1.useMemo(() => createActionHandeller(action), [action, createActionHandeller]);
27
27
  };
28
28
  exports.useAction = useAction;
29
29
  const useAsyncAction = (action) => {
@@ -32,14 +32,16 @@ const useAsyncAction = (action) => {
32
32
  const actionHandeller = react_1.useMemo(() => action ? createActionHandeller(action) : null, [action, createActionHandeller]);
33
33
  const handleAction = react_1.useCallback((event) => __awaiter(void 0, void 0, void 0, function* () {
34
34
  setIsProcessing(true);
35
+ let actionRes;
35
36
  try {
36
- yield actionHandeller(event);
37
+ actionRes = yield actionHandeller(event);
37
38
  }
38
39
  catch (error) {
39
40
  console.error(error);
40
41
  }
41
42
  finally {
42
43
  setIsProcessing(false);
44
+ return actionRes;
43
45
  }
44
46
  }), [actionHandeller]);
45
47
  return [isProcessing, handleAction];
@@ -1 +1 @@
1
- {"version":3,"file":"useAction.js","sourceRoot":"","sources":["../../../src/hooks/useAction.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,iCAAuD;AACvD,oEAAwD;AAExD,qCAAqC;AACrC;;;;GAIG;AAEI,MAAM,SAAS,GAAG,CAAC,MAAe,EAAC,EAAE;IACxC,MAAM,qBAAqB,GAAG,uBAAa,EAAE,CAAC;IAE9C,OAAO,eAAO,CAAC,GAAE,EAAE,CAAA,MAAM,CAAC,CAAC,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAC;AACvG,CAAC,CAAC;AAJW,QAAA,SAAS,aAIpB;AAEK,MAAM,cAAc,GAAG,CAAC,MAAe,EAAC,EAAE;IAC7C,MAAM,qBAAqB,GAAG,uBAAa,EAAE,CAAC;IAC9C,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,gBAAQ,CAAC,KAAK,CAAC,CAAC;IAExD,MAAM,eAAe,GAAG,eAAO,CAAC,GAAE,EAAE,CAAA,MAAM,CAAC,CAAC,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAC;IAEpH,MAAM,YAAY,GAAG,mBAAW,CAAC,CAAO,KAAU,EAAC,EAAE;QACjD,eAAe,CAAC,IAAI,CAAC,CAAC;QACtB,IAA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Ac,CAAC;QACnB,IAAG;YACC,SAAS,GAAG,MAAM,eAAe,CAAC,KAAK,CAAC,CAAC;SAC5C;QAAA,OAAM,KAAK,EAAC;YACT,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SACxB;gBAAO;YACJ,eAAe,CAAC,KAAK,CAAC,CAAC;YACvB,OAAO,SAAS,CAAC;SACpB;IACL,CAAC,CAAA,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC;IAEtB,OAAO,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;AACxC,CAAC,CAAC;AApBW,QAAA,cAAc,kBAoBzB;AAEF,kBAAe,iBAAS,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evlop/commons",
3
- "version": "1.0.230",
3
+ "version": "1.0.231",
4
4
  "description": "",
5
5
  "main": "dist/main.js",
6
6
  "peerDependencies": {