@swan-admin/swan-ai-measurements 1.0.79 → 1.0.81
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/package.json +1 -1
- package/src/utils.ts +11 -5
package/package.json
CHANGED
package/src/utils.ts
CHANGED
|
@@ -24,12 +24,18 @@ export async function fetchData(options: FetchDataOptions): Promise<any> {
|
|
|
24
24
|
|
|
25
25
|
const apiUrl = `${baseUrl}${path}${queryParams ? `?${new URLSearchParams(queryParams)}` : ""}`;
|
|
26
26
|
try {
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
const response = await fetch(apiUrl, {
|
|
28
|
+
method: "POST",
|
|
29
|
+
headers,
|
|
30
|
+
body: JSON.stringify(body),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
if (!response.ok) {
|
|
34
|
+
throw new Error(`Error: Unexpected response status ${response.status}`);
|
|
30
35
|
}
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
|
|
37
|
+
const data = await response.json();
|
|
38
|
+
return data;
|
|
33
39
|
} catch (error) {
|
|
34
40
|
console.error(error, "while uploading");
|
|
35
41
|
return {};
|