Shared: Utils: Fixed force redirect inside frame on 401 response
This commit is contained in:
parent
bc3728aabf
commit
cfc7cf0114
@ -220,10 +220,12 @@ class AxiosClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const loginURL = combineUrl(proxyURL, "/login");
|
const loginURL = combineUrl(proxyURL, "/login");
|
||||||
|
|
||||||
if (!this.isSSR) {
|
if (!this.isSSR) {
|
||||||
switch (error.response?.status) {
|
switch (error.response?.status) {
|
||||||
case 401: {
|
case 401: {
|
||||||
if (options.skipUnauthorized) return Promise.resolve();
|
if (options.skipUnauthorized || window?.ClientConfig?.isFrame)
|
||||||
|
return Promise.resolve();
|
||||||
if (options.skipLogout) return Promise.reject(error);
|
if (options.skipLogout) return Promise.reject(error);
|
||||||
|
|
||||||
const opt: AxiosRequestConfig = {
|
const opt: AxiosRequestConfig = {
|
||||||
@ -244,14 +246,13 @@ class AxiosClient {
|
|||||||
break;
|
break;
|
||||||
case 403: {
|
case 403: {
|
||||||
const pathname = window.location.pathname;
|
const pathname = window.location.pathname;
|
||||||
const isFrame = window?.ClientConfig?.isFrame;
|
|
||||||
|
|
||||||
const isArchived = pathname.indexOf("/rooms/archived") !== -1;
|
const isArchived = pathname.indexOf("/rooms/archived") !== -1;
|
||||||
|
|
||||||
const isRooms =
|
const isRooms =
|
||||||
pathname.indexOf("/rooms/shared") !== -1 || isArchived;
|
pathname.indexOf("/rooms/shared") !== -1 || isArchived;
|
||||||
|
|
||||||
if (isRooms && !skipRedirect && !isFrame) {
|
if (isRooms && !skipRedirect && !window?.ClientConfig?.isFrame) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.DocSpace.navigate(isArchived ? "/archived" : "/");
|
window.DocSpace.navigate(isArchived ? "/archived" : "/");
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
Loading…
Reference in New Issue
Block a user