@hubs101/js-api-skd-client 1.0.10628 → 1.0.10630
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/lib/api/event/index.js +1 -1
- package/lib/utils/api.d.ts +1 -4
- package/lib/utils/api.js +7 -45
- package/package.json +1 -1
package/lib/api/event/index.js
CHANGED
|
@@ -898,7 +898,7 @@ const _updateEventFaqs = (basePath, token, eventId, data) => __awaiter(void 0, v
|
|
|
898
898
|
exports._updateEventFaqs = _updateEventFaqs;
|
|
899
899
|
const _updateEventSpeakerAdverts = (basePath, token, eventId, data, files) => __awaiter(void 0, void 0, void 0, function* () {
|
|
900
900
|
const base = (0, base_1.getBasePath)(basePath);
|
|
901
|
-
const response = yield (0, api_1.
|
|
901
|
+
const response = yield (0, api_1.postFilesAndDataRequest)(`${base.EVENTS}/${eventId}/speakeradverts`, data, files !== null && files !== void 0 ? files : [], token, "put");
|
|
902
902
|
return (response === null || response === void 0 ? void 0 : response.data) || response;
|
|
903
903
|
});
|
|
904
904
|
exports._updateEventSpeakerAdverts = _updateEventSpeakerAdverts;
|
package/lib/utils/api.d.ts
CHANGED
|
@@ -24,7 +24,4 @@ export declare const postFileRequestWE: (url: string, file: File, param: string,
|
|
|
24
24
|
export declare const postRequestJSON: (url: string, body?: any, token?: string, headers?: any) => Promise<any>;
|
|
25
25
|
export declare const patchRequestWe: (url: string, body: Record<string, string>, token: string) => Promise<any>;
|
|
26
26
|
export declare const postWithAttachments: (url: string, formData: any, token: string, headers?: any) => Promise<any>;
|
|
27
|
-
export declare const putRequestDirect: (url: string, token: string, body: any
|
|
28
|
-
name: string;
|
|
29
|
-
value: File;
|
|
30
|
-
}[]) => Promise<any>;
|
|
27
|
+
export declare const putRequestDirect: (url: string, token: string, body: any) => Promise<any>;
|
package/lib/utils/api.js
CHANGED
|
@@ -554,53 +554,15 @@ const postWithAttachments = (url, formData, token, headers) => __awaiter(void 0,
|
|
|
554
554
|
}
|
|
555
555
|
});
|
|
556
556
|
exports.postWithAttachments = postWithAttachments;
|
|
557
|
-
const putRequestDirect = (url, token, body
|
|
558
|
-
let requestBody;
|
|
559
|
-
let contentType;
|
|
560
|
-
if (files && files.length > 0) {
|
|
561
|
-
// Use FormData when files are provided
|
|
562
|
-
const formData = new FormData();
|
|
563
|
-
// Add body fields to FormData
|
|
564
|
-
Object.keys((0, exports.trimUndefined)(body)).forEach((key) => {
|
|
565
|
-
if (Array.isArray(body[key])) {
|
|
566
|
-
formData.append(key, JSON.stringify(body[key]));
|
|
567
|
-
}
|
|
568
|
-
else {
|
|
569
|
-
formData.append(key, body[key]);
|
|
570
|
-
}
|
|
571
|
-
});
|
|
572
|
-
// Add files to FormData
|
|
573
|
-
files.forEach((file) => {
|
|
574
|
-
if (file.value && typeof file.value === "string") {
|
|
575
|
-
return;
|
|
576
|
-
}
|
|
577
|
-
if (!file.value) {
|
|
578
|
-
formData.append(file.name, "");
|
|
579
|
-
}
|
|
580
|
-
else {
|
|
581
|
-
formData.append(file.name, file.value, file.name);
|
|
582
|
-
}
|
|
583
|
-
});
|
|
584
|
-
requestBody = formData;
|
|
585
|
-
contentType = "multipart/form-data";
|
|
586
|
-
}
|
|
587
|
-
else {
|
|
588
|
-
// Use JSON when no files
|
|
589
|
-
requestBody = JSON.stringify(body);
|
|
590
|
-
contentType = "application/json";
|
|
591
|
-
}
|
|
592
|
-
const headers = {
|
|
593
|
-
accept: "application/json",
|
|
594
|
-
Authorization: `Bearer ${token}`,
|
|
595
|
-
};
|
|
596
|
-
// Only set Content-Type for JSON (browser will set it for FormData with boundary)
|
|
597
|
-
if (contentType === "application/json") {
|
|
598
|
-
headers["Content-Type"] = contentType;
|
|
599
|
-
}
|
|
557
|
+
const putRequestDirect = (url, token, body) => __awaiter(void 0, void 0, void 0, function* () {
|
|
600
558
|
const response = yield fetch(url, {
|
|
601
559
|
method: "PUT",
|
|
602
|
-
headers
|
|
603
|
-
|
|
560
|
+
headers: {
|
|
561
|
+
accept: "application/json",
|
|
562
|
+
"Content-Type": "application/json",
|
|
563
|
+
Authorization: `Bearer ${token}`,
|
|
564
|
+
},
|
|
565
|
+
body: JSON.stringify(body),
|
|
604
566
|
});
|
|
605
567
|
const data = yield response.json();
|
|
606
568
|
if (String(data.status).startsWith("4")) {
|