@escapenavigator/services 1.10.114 → 1.10.116
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/api/cashboxes-api/query.d.ts +3 -3
- package/dist/api/locations-api/query.d.ts +3 -3
- package/dist/api/questrooms-api/query.d.ts +2 -2
- package/dist/api/roles-api/query.d.ts +3 -3
- package/dist/api/statistics-api/promocodes-report.d.ts +2 -3
- package/dist/api/tariffs-api/query.d.ts +3 -3
- package/dist/api/users-api/query.d.ts +3 -3
- package/dist/hooks/use-api-method/index.js +27 -10
- package/package.json +4 -4
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CashboxLightRO } from '@escapenavigator/types/dist/cashbox/cashbox-light.ro';
|
|
2
2
|
import { ApiMethodDeclaration } from '..';
|
|
3
3
|
type ParamsData = {
|
|
4
|
-
etag?:
|
|
4
|
+
etag?: string | null;
|
|
5
5
|
};
|
|
6
|
-
type ResponseData =
|
|
6
|
+
type ResponseData = CashboxLightRO[];
|
|
7
7
|
export declare const query: ApiMethodDeclaration<ParamsData, ResponseData>;
|
|
8
8
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LocationLightRO } from '@escapenavigator/types/dist/location/location-light.ro';
|
|
2
2
|
import { ApiMethodDeclaration } from '..';
|
|
3
3
|
type ParamsData = {
|
|
4
|
-
etag?:
|
|
4
|
+
etag?: string | null;
|
|
5
5
|
};
|
|
6
|
-
type ResponseData =
|
|
6
|
+
type ResponseData = LocationLightRO[];
|
|
7
7
|
export declare const query: ApiMethodDeclaration<ParamsData, ResponseData>;
|
|
8
8
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { QuestroomLightRO } from '@escapenavigator/types/dist/questroom/questroom-light.ro';
|
|
2
2
|
import { ApiMethodDeclaration } from '..';
|
|
3
3
|
type ParamsData = {
|
|
4
4
|
etag?: string | null;
|
|
5
5
|
};
|
|
6
|
-
type ResponseData =
|
|
6
|
+
type ResponseData = QuestroomLightRO[];
|
|
7
7
|
export declare const query: ApiMethodDeclaration<ParamsData, ResponseData>;
|
|
8
8
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RoleLightRO } from '@escapenavigator/types/dist/role/role-light.ro';
|
|
2
2
|
import { ApiMethodDeclaration } from '..';
|
|
3
3
|
type ParamsData = {
|
|
4
|
-
etag?:
|
|
4
|
+
etag?: string | null;
|
|
5
5
|
};
|
|
6
|
-
type ResponseData =
|
|
6
|
+
type ResponseData = RoleLightRO[];
|
|
7
7
|
export declare const query: ApiMethodDeclaration<ParamsData, ResponseData>;
|
|
8
8
|
export {};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PromocodesReportRO } from '@escapenavigator/types/dist/statistics/promocodes';
|
|
1
|
+
import { PromocodesQueryDto, PromocodesReportRO } from '@escapenavigator/types/dist/statistics/promocodes';
|
|
3
2
|
import { ApiMethodDeclaration } from '..';
|
|
4
3
|
type ParamsData = {
|
|
5
|
-
data:
|
|
4
|
+
data: PromocodesQueryDto;
|
|
6
5
|
};
|
|
7
6
|
type ResponseData = PromocodesReportRO;
|
|
8
7
|
export declare const promocodesReport: ApiMethodDeclaration<ParamsData, ResponseData>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TariffLightRO } from '@escapenavigator/types/dist/tariff/tariff-light.ro';
|
|
2
2
|
import { ApiMethodDeclaration } from '..';
|
|
3
3
|
type ParamsData = {
|
|
4
|
-
etag?:
|
|
4
|
+
etag?: string | null;
|
|
5
5
|
};
|
|
6
|
-
type ResponseData =
|
|
6
|
+
type ResponseData = TariffLightRO[];
|
|
7
7
|
export declare const query: ApiMethodDeclaration<ParamsData, ResponseData>;
|
|
8
8
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UserLightRO } from '@escapenavigator/types/dist/user/crud/user-light.ro';
|
|
2
2
|
import { ApiMethodDeclaration } from '..';
|
|
3
3
|
type ParamsData = {
|
|
4
|
-
etag?:
|
|
4
|
+
etag?: string | null;
|
|
5
5
|
};
|
|
6
|
-
type ResponseData =
|
|
6
|
+
type ResponseData = UserLightRO[];
|
|
7
7
|
export declare const query: ApiMethodDeclaration<ParamsData, ResponseData>;
|
|
8
8
|
export {};
|
|
@@ -63,39 +63,56 @@ var useApiMethod = function (_a) {
|
|
|
63
63
|
successCallbackRef.current = successCallback;
|
|
64
64
|
errorCallbackRef.current = errorCallback;
|
|
65
65
|
var fetch = (0, react_1.useCallback)(function (params) { return __awaiter(void 0, void 0, void 0, function () {
|
|
66
|
-
var response, error_1, err;
|
|
67
|
-
var
|
|
68
|
-
return __generator(this, function (
|
|
69
|
-
switch (
|
|
66
|
+
var response, error_1, text, _a, err;
|
|
67
|
+
var _b, _c, _d, _e;
|
|
68
|
+
return __generator(this, function (_f) {
|
|
69
|
+
switch (_f.label) {
|
|
70
70
|
case 0:
|
|
71
|
-
(
|
|
71
|
+
(_b = source.current) === null || _b === void 0 ? void 0 : _b.cancel();
|
|
72
72
|
source.current = axios_1.default.CancelToken.source();
|
|
73
|
-
|
|
73
|
+
_f.label = 1;
|
|
74
74
|
case 1:
|
|
75
|
-
|
|
75
|
+
_f.trys.push([1, 3, , 8]);
|
|
76
76
|
dispatch((0, api_1.fetchStart)());
|
|
77
77
|
return [4 /*yield*/, api(params, {
|
|
78
78
|
cancelToken: source.current.token,
|
|
79
79
|
})];
|
|
80
80
|
case 2:
|
|
81
|
-
response =
|
|
81
|
+
response = _f.sent();
|
|
82
82
|
if (successCallbackRef.current)
|
|
83
83
|
successCallbackRef.current(response, params);
|
|
84
84
|
dispatch((0, api_1.fetchSuccess)(response));
|
|
85
85
|
return [2 /*return*/, response];
|
|
86
86
|
case 3:
|
|
87
|
-
error_1 =
|
|
87
|
+
error_1 = _f.sent();
|
|
88
88
|
if (axios_1.default.isCancel(error_1))
|
|
89
89
|
return [2 /*return*/, null];
|
|
90
90
|
if (!mounted.current)
|
|
91
91
|
return [2 /*return*/, null];
|
|
92
|
+
if (!(axios_1.default.isAxiosError(error_1) &&
|
|
93
|
+
((_c = error_1.response) === null || _c === void 0 ? void 0 : _c.data) instanceof Blob &&
|
|
94
|
+
(((_d = error_1.response.data.type) === null || _d === void 0 ? void 0 : _d.includes('application/json')) ||
|
|
95
|
+
((_e = error_1.response.data.type) === null || _e === void 0 ? void 0 : _e.includes('application/problem+json'))))) return [3 /*break*/, 7];
|
|
96
|
+
_f.label = 4;
|
|
97
|
+
case 4:
|
|
98
|
+
_f.trys.push([4, 6, , 7]);
|
|
99
|
+
return [4 /*yield*/, error_1.response.data.text()];
|
|
100
|
+
case 5:
|
|
101
|
+
text = _f.sent();
|
|
102
|
+
// Перетираем `data` — getServiceError рассчитывает на объект.
|
|
103
|
+
error_1.response.data = JSON.parse(text);
|
|
104
|
+
return [3 /*break*/, 7];
|
|
105
|
+
case 6:
|
|
106
|
+
_a = _f.sent();
|
|
107
|
+
return [3 /*break*/, 7];
|
|
108
|
+
case 7:
|
|
92
109
|
err = (0, get_service_error_1.getServiceError)(error_1);
|
|
93
110
|
if (errorCallbackRef.current)
|
|
94
111
|
errorCallbackRef.current(err);
|
|
95
112
|
dispatch((0, api_1.fetchFailure)(err));
|
|
96
113
|
// eslint-disable-next-line @typescript-eslint/no-throw-literal
|
|
97
114
|
throw err;
|
|
98
|
-
case
|
|
115
|
+
case 8: return [2 /*return*/];
|
|
99
116
|
}
|
|
100
117
|
});
|
|
101
118
|
}); }, [api]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@escapenavigator/services",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.116",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build": "rm -rf dist && tsc --project tsconfig.json"
|
|
14
14
|
},
|
|
15
|
-
"gitHead": "
|
|
15
|
+
"gitHead": "a01481bc86de3662a353e0a62c1c03ebe5b4a5a8",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@escapenavigator/types": "^1.10.
|
|
18
|
-
"@escapenavigator/utils": "^1.10.
|
|
17
|
+
"@escapenavigator/types": "^1.10.107",
|
|
18
|
+
"@escapenavigator/utils": "^1.10.111",
|
|
19
19
|
"axios": "^0.21.4",
|
|
20
20
|
"class-transformer": "^0.5.1",
|
|
21
21
|
"class-validator": "^0.13.2",
|