revdev-components 0.32.0 → 0.33.0
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function useApiMutation<TResponse, TRequest>(useMutation:
|
|
1
|
+
import { ApiMutationMethod, ApiMutationResponse } from ".";
|
|
2
|
+
export declare function useApiMutation<TResponse, TRequest>(useMutation: ApiMutationMethod<TResponse, TRequest>, success?: (response: TResponse) => void): ApiMutationResponse<TResponse, TRequest>;
|
package/build/index.js
CHANGED
|
@@ -4762,7 +4762,7 @@ exports.ApiStatus = void 0;
|
|
|
4762
4762
|
ApiStatus[ApiStatus["NotFound"] = 3] = "NotFound";
|
|
4763
4763
|
})(exports.ApiStatus || (exports.ApiStatus = {}));
|
|
4764
4764
|
|
|
4765
|
-
function
|
|
4765
|
+
function useApiLazyQueryRequest(request, useLazyQuery) {
|
|
4766
4766
|
var _a = React.useState(exports.ApiStatus.Loading), status = _a[0], setStatus = _a[1];
|
|
4767
4767
|
var _b = useLazyQuery(), requestMethod = _b[0], responseObject = _b[1];
|
|
4768
4768
|
React.useEffect(function () {
|
|
@@ -4784,6 +4784,27 @@ function useApiLazy(request, useLazyQuery) {
|
|
|
4784
4784
|
return [responseObject.data, status];
|
|
4785
4785
|
}
|
|
4786
4786
|
|
|
4787
|
+
function useApiLazyQuery(useLazyQuery, success) {
|
|
4788
|
+
var _a = React.useState(exports.ApiStatus.Loading), status = _a[0], setStatus = _a[1];
|
|
4789
|
+
var _b = useLazyQuery(), requestMethod = _b[0], responseObject = _b[1];
|
|
4790
|
+
React.useEffect(function () {
|
|
4791
|
+
if (responseObject.isSuccess) {
|
|
4792
|
+
var data = responseObject.data;
|
|
4793
|
+
if (data) {
|
|
4794
|
+
success === null || success === void 0 ? void 0 : success(data);
|
|
4795
|
+
}
|
|
4796
|
+
setStatus(exports.ApiStatus.Success);
|
|
4797
|
+
}
|
|
4798
|
+
}, [responseObject]);
|
|
4799
|
+
return React.useMemo(function () {
|
|
4800
|
+
return {
|
|
4801
|
+
request: requestMethod,
|
|
4802
|
+
response: responseObject.data,
|
|
4803
|
+
status: status,
|
|
4804
|
+
};
|
|
4805
|
+
}, [requestMethod, responseObject, status]);
|
|
4806
|
+
}
|
|
4807
|
+
|
|
4787
4808
|
function useApiMutation(useMutation, success) {
|
|
4788
4809
|
var _a = React.useState(exports.ApiStatus.Loading), status = _a[0], setStatus = _a[1];
|
|
4789
4810
|
var _b = useMutation(), requestMethod = _b[0], responseObject = _b[1];
|
|
@@ -5064,7 +5085,8 @@ exports.SelectField = SelectField;
|
|
|
5064
5085
|
exports.SocialIcon = SocialIcon;
|
|
5065
5086
|
exports.SocialIconNameList = SocialIconNameList;
|
|
5066
5087
|
exports.TextAreaField = TextAreaField;
|
|
5067
|
-
exports.
|
|
5088
|
+
exports.useApiLazyQuery = useApiLazyQuery;
|
|
5089
|
+
exports.useApiLazyQueryRequest = useApiLazyQueryRequest;
|
|
5068
5090
|
exports.useApiMutation = useApiMutation;
|
|
5069
5091
|
exports.useAppFormRules = useAppFormRules;
|
|
5070
5092
|
exports.useDebounceEffect = useDebounceEffect;
|
package/package.json
CHANGED