@opengeoweb/api 5.2.0 → 6.0.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.
package/index.js
CHANGED
|
@@ -419,9 +419,9 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
419
419
|
var generateRandomId = function generateRandomId() {
|
|
420
420
|
return "-".concat(Math.random().toString(36).substr(2, 9));
|
|
421
421
|
};
|
|
422
|
+
var useApi = function useApi(
|
|
422
423
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
423
|
-
|
|
424
|
-
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
424
|
+
apiCall, params) {
|
|
425
425
|
var _useIsMounted = useIsMounted(),
|
|
426
426
|
isMounted = _useIsMounted.isMounted;
|
|
427
427
|
var _React$useState = React.useState(generateRandomId()),
|
|
@@ -440,8 +440,7 @@ var useApi = function useApi(apiCall) {
|
|
|
440
440
|
result = _React$useState8[0],
|
|
441
441
|
setResult = _React$useState8[1];
|
|
442
442
|
var debouncedParams = useDebounce(JSON.stringify(params), 300);
|
|
443
|
-
var fetchApiData = function fetchApiData() {
|
|
444
|
-
var _params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
443
|
+
var fetchApiData = function fetchApiData(_params) {
|
|
445
444
|
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
446
445
|
var response;
|
|
447
446
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "GeoWeb API library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"types": "./src/index.d.ts",
|
|
14
14
|
"dependencies": {},
|
|
15
15
|
"peerDependencies": {
|
|
16
|
-
"@opengeoweb/shared": "
|
|
16
|
+
"@opengeoweb/shared": "6.0.0",
|
|
17
17
|
"axios": "1.4.0",
|
|
18
18
|
"react": "18.2.0"
|
|
19
19
|
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import { ConfigType } from '@opengeoweb/shared';
|
|
2
|
+
export declare type ApiParams = string | ConfigType | {
|
|
3
|
+
[key: string]: string | undefined;
|
|
4
|
+
} | null;
|
|
1
5
|
export interface ApiHookProps {
|
|
2
6
|
isLoading: boolean;
|
|
3
7
|
error: Error;
|
|
4
8
|
result: any;
|
|
5
|
-
fetchApiData?: (params:
|
|
9
|
+
fetchApiData?: (params: ApiParams) => Promise<void>;
|
|
6
10
|
clearResults?: () => void;
|
|
7
11
|
}
|
|
8
|
-
export declare const useApi: (apiCall
|
|
12
|
+
export declare const useApi: (apiCall?: ((params?: ApiParams | undefined, id?: string | undefined) => Promise<any>) | undefined, params?: ApiParams | undefined) => ApiHookProps;
|