Attempt to fix or at least help debug #1028
parent
9e3fe5db73
commit
6ef9dc8b99
|
@ -37,23 +37,28 @@ export class HttpSpacePrimitives implements SpacePrimitives {
|
||||||
if (result.status === 503) {
|
if (result.status === 503) {
|
||||||
throw new Error("Offline");
|
throw new Error("Offline");
|
||||||
}
|
}
|
||||||
|
// Attempting to handle various authentication proxies
|
||||||
if (result.redirected) {
|
if (result.redirected) {
|
||||||
if (result.status === 401) {
|
if (result.status === 401 || result.status === 403) {
|
||||||
console.log(
|
console.log(
|
||||||
"Received unauthorized status and got a redirect via the API so will redirect to URL",
|
"Received unauthorized status and got a redirect via the API so will redirect to URL",
|
||||||
result.url,
|
result.url,
|
||||||
);
|
);
|
||||||
alert("You are not authenticated, redirecting to login page...");
|
alert("You are not authenticated, redirecting to: " + result.url);
|
||||||
location.href = result.url;
|
location.href = result.url;
|
||||||
throw new Error("Not authenticated");
|
throw new Error("Not authenticated");
|
||||||
} else {
|
} else {
|
||||||
|
alert("Received a redirect, redirecting to URL: " + result.url);
|
||||||
location.href = result.url;
|
location.href = result.url;
|
||||||
throw new Error("Redirected");
|
throw new Error("Redirected");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result.status === 401) {
|
if (result.status === 401 || result.status === 403) {
|
||||||
|
alert(
|
||||||
|
"You are not authenticated, going to reload and hope that that kicks off authentication",
|
||||||
|
);
|
||||||
location.reload();
|
location.reload();
|
||||||
throw new Error("Not authenticated, got 403");
|
throw new Error("Not authenticated, got 401");
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
|
|
Loading…
Reference in New Issue