Common:Axios: fix 403 error after fetch folder into files selector
This commit is contained in:
parent
8b64561196
commit
96e56f2245
@ -336,7 +336,7 @@ export const useFilesHelper = ({
|
||||
isErrorPath = false
|
||||
) => {
|
||||
if (isInit && getRootData) {
|
||||
const folder = await getFolderInfo(folderId);
|
||||
const folder = await getFolderInfo(folderId, true);
|
||||
|
||||
const isArchive = folder.rootFolderType === FolderType.Archive;
|
||||
|
||||
@ -435,6 +435,7 @@ export const useFilesHelper = ({
|
||||
try {
|
||||
await setSettings(id);
|
||||
} catch (e) {
|
||||
sessionStorage.removeItem("filesSelectorPath");
|
||||
if (isThirdParty && rootThirdPartyId) {
|
||||
await setSettings(rootThirdPartyId, true);
|
||||
|
||||
|
@ -6,8 +6,8 @@ export const initSSR = (headers) => {
|
||||
client.initSSR(headers);
|
||||
};
|
||||
|
||||
export const request = (options) => {
|
||||
return client.request(options);
|
||||
export const request = (options, isSelector = false) => {
|
||||
return client.request(options, isSelector);
|
||||
};
|
||||
|
||||
export const setWithCredentialsStatus = (state) => {
|
||||
|
@ -49,13 +49,13 @@ export function getReferenceData(object) {
|
||||
return request(options);
|
||||
}
|
||||
|
||||
export function getFolderInfo(folderId) {
|
||||
export function getFolderInfo(folderId, isSelector = false) {
|
||||
const options = {
|
||||
method: "get",
|
||||
url: `/files/folder/${folderId}`,
|
||||
};
|
||||
|
||||
return request(options);
|
||||
return request(options, isSelector);
|
||||
}
|
||||
|
||||
export function getFolderPath(folderId) {
|
||||
|
@ -111,7 +111,7 @@ class AxiosClient {
|
||||
}
|
||||
};
|
||||
|
||||
request = (options) => {
|
||||
request = (options, isSelector = false) => {
|
||||
const onSuccess = (response) => {
|
||||
const error = this.getResponseError(response);
|
||||
if (error) throw new Error(error);
|
||||
@ -161,6 +161,7 @@ class AxiosClient {
|
||||
}
|
||||
break;
|
||||
case 403:
|
||||
if (isSelector) return;
|
||||
const pathname = window.location.pathname;
|
||||
const isArchived = pathname.indexOf("/rooms/archived") !== -1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user