Send BIM viewer requests with credentials
This commit is contained in:
parent
3806848b07
commit
477626c597
|
|
@ -302,7 +302,7 @@ export const fetchBeamConversionStatus = async (beamViewer: TBeamViewerAttachmen
|
||||||
const statusUrl = new URL("/api/conversions/status", `${getBeamApiBaseUrl()}/`);
|
const statusUrl = new URL("/api/conversions/status", `${getBeamApiBaseUrl()}/`);
|
||||||
statusUrl.searchParams.set("src", toBeamRelativeUploadSrc(beamViewer.src));
|
statusUrl.searchParams.set("src", toBeamRelativeUploadSrc(beamViewer.src));
|
||||||
|
|
||||||
const response = await fetch(statusUrl.toString());
|
const response = await fetch(statusUrl.toString(), { credentials: "include" });
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`BIM conversion status failed: HTTP ${response.status}`);
|
throw new Error(`BIM conversion status failed: HTTP ${response.status}`);
|
||||||
}
|
}
|
||||||
|
|
@ -347,6 +347,7 @@ export const uploadBeamModelFile = (
|
||||||
|
|
||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
xhr.open("POST", uploadUrl.toString());
|
xhr.open("POST", uploadUrl.toString());
|
||||||
|
xhr.withCredentials = true;
|
||||||
xhr.setRequestHeader("Content-Type", "application/octet-stream");
|
xhr.setRequestHeader("Content-Type", "application/octet-stream");
|
||||||
xhr.upload.addEventListener("progress", (event) => {
|
xhr.upload.addEventListener("progress", (event) => {
|
||||||
if (!event.lengthComputable || !options.onUploadProgress) return;
|
if (!event.lengthComputable || !options.onUploadProgress) return;
|
||||||
|
|
@ -443,6 +444,7 @@ const deleteBeamStorageResource = async (
|
||||||
): Promise<void> => {
|
): Promise<void> => {
|
||||||
const response = await fetch(new URL(endpoint, `${getBeamApiBaseUrl()}/`).toString(), {
|
const response = await fetch(new URL(endpoint, `${getBeamApiBaseUrl()}/`).toString(), {
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
|
credentials: "include",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue