@swan-admin/swan-ai-measurements 1.0.80 → 1.0.82
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/esm/fileUpload.d.ts +1 -1
- package/dist/esm/utils.js +9 -6
- package/dist/fileUpload.d.ts +1 -1
- package/dist/utils.js +9 -9
- package/package.json +1 -1
- package/src/fileUpload.ts +1 -1
package/dist/esm/fileUpload.d.ts
CHANGED
package/dist/esm/utils.js
CHANGED
|
@@ -7,7 +7,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import axios from "axios";
|
|
11
10
|
import { APP_AUTH_BASE_URL, requiredMetaData } from "./constants.js";
|
|
12
11
|
export function fetchData(options) {
|
|
13
12
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -15,12 +14,16 @@ export function fetchData(options) {
|
|
|
15
14
|
console.log(body, "body", path, "path");
|
|
16
15
|
const apiUrl = `${baseUrl}${path}${queryParams ? `?${new URLSearchParams(queryParams)}` : ""}`;
|
|
17
16
|
try {
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
const response = yield fetch(apiUrl, {
|
|
18
|
+
method: "POST",
|
|
19
|
+
headers,
|
|
20
|
+
body: JSON.stringify(body),
|
|
21
|
+
});
|
|
22
|
+
if (!response.ok) {
|
|
23
|
+
throw new Error(`Error: Unexpected response status ${response.status}`);
|
|
21
24
|
}
|
|
22
|
-
|
|
23
|
-
return
|
|
25
|
+
const data = yield response.json();
|
|
26
|
+
return data;
|
|
24
27
|
}
|
|
25
28
|
catch (error) {
|
|
26
29
|
console.error(error, "while uploading");
|
package/dist/fileUpload.d.ts
CHANGED
package/dist/utils.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.checkMetaDataValue = exports.checkParameters = exports.fetchData = void 0;
|
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
|
8
4
|
const constants_js_1 = require("./constants.js");
|
|
9
5
|
async function fetchData(options) {
|
|
10
6
|
const { path, body, queryParams, baseUrl = constants_js_1.APP_AUTH_BASE_URL, apiKey = "", headers = { "X-Api-Key": apiKey, "Content-Type": "application/json" }, } = options;
|
|
11
7
|
console.log(body, "body", path, "path");
|
|
12
8
|
const apiUrl = `${baseUrl}${path}${queryParams ? `?${new URLSearchParams(queryParams)}` : ""}`;
|
|
13
9
|
try {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
const response = await fetch(apiUrl, {
|
|
11
|
+
method: "POST",
|
|
12
|
+
headers,
|
|
13
|
+
body: JSON.stringify(body),
|
|
14
|
+
});
|
|
15
|
+
if (!response.ok) {
|
|
16
|
+
throw new Error(`Error: Unexpected response status ${response.status}`);
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
return
|
|
18
|
+
const data = await response.json();
|
|
19
|
+
return data;
|
|
20
20
|
}
|
|
21
21
|
catch (error) {
|
|
22
22
|
console.error(error, "while uploading");
|
package/package.json
CHANGED