Web:Client: fix click on back

This commit is contained in:
Timofey Boyko 2023-09-19 11:17:49 +03:00
parent 2cbd3e05b8
commit 849ca096fd

View File

@ -2136,7 +2136,7 @@ class FilesActionStore {
}; };
onClickBack = () => { onClickBack = () => {
const { roomType } = this.selectedFolderStore; const { roomType, ...rest } = this.selectedFolderStore;
const { setSelectedNode } = this.treeFoldersStore; const { setSelectedNode } = this.treeFoldersStore;
const { clearFiles } = this.filesStore; const { clearFiles } = this.filesStore;
@ -2181,19 +2181,19 @@ class FilesActionStore {
setSelectedNode(["common"]); setSelectedNode(["common"]);
return navigate(path, { replace: true }); return window.DocSpace.navigate(path, { replace: true });
} }
if (categoryType === CategoryType.Accounts) { if (categoryType === CategoryType.Accounts) {
const accountsFilter = AccountsFilter.getDefault(); const accountsFilter = AccountsFilter.getDefault();
params = accountsFilter.toUrlParams(); const params = accountsFilter.toUrlParams();
const path = getCategoryUrl(CategoryType.Accounts); const path = getCategoryUrl(CategoryType.Accounts);
clearFiles(); clearFiles();
setSelectedNode(["accounts", "filter"]); setSelectedNode(["accounts", "filter"]);
return navigate(`${path}?${params}`, { replace: true }); return window.DocSpace.navigate(`${path}?${params}`, { replace: true });
} }
}; };
@ -2202,13 +2202,22 @@ class FilesActionStore {
const filter = RoomsFilter.getDefault(); const filter = RoomsFilter.getDefault();
const path = getCategoryUrl(categoryType); const correctCategoryType =
categoryType === CategoryType.SharedRoom
? CategoryType.Shared
: CategoryType.ArchivedRoom === categoryType
? CategoryType.Archive
: categoryType;
const path = getCategoryUrl(correctCategoryType);
const state = { const state = {
title: title:
this.selectedFolderStore?.navigationPath[ (this.selectedFolderStore?.navigationPath &&
this.selectedFolderStore?.navigationPath.length - 1 this.selectedFolderStore?.navigationPath[
]?.title || "", this.selectedFolderStore?.navigationPath?.length - 1
]?.title) ||
"",
isRoot: true, isRoot: true,
rootFolderType: this.selectedFolderStore.rootFolderType, rootFolderType: this.selectedFolderStore.rootFolderType,
}; };
@ -2255,7 +2264,9 @@ class FilesActionStore {
setIsSectionFilterLoading(param); setIsSectionFilterLoading(param);
}; };
let id = this.selectedFolderStore.parentId; const id = this.selectedFolderStore.parentId;
console.log(id);
const { navigationPath, rootFolderType } = this.selectedFolderStore; const { navigationPath, rootFolderType } = this.selectedFolderStore;
@ -2263,16 +2274,19 @@ class FilesActionStore {
filter.folder = id; filter.folder = id;
const categoryType = getCategoryType(window.DocSpace.location);
const path = getCategoryUrl(categoryType, id);
const state = { const state = {
title: navigationPath[0]?.title || "", title: (navigationPath && navigationPath[0]?.title) || "",
isRoot: navigationPath.length === 1, isRoot: navigationPath.length === 1,
rootFolderType: rootFolderType, rootFolderType: rootFolderType,
}; };
window.DocSpace.navigate( window.DocSpace.navigate(`${path}?${filter.toUrlParams()}`, {
`${window.DocSpace.location.pathname}?${filter.toUrlParams()}`, state,
{ state, replace: true } replace: true,
); });
}; };
setGroupMenuBlocked = (blocked) => { setGroupMenuBlocked = (blocked) => {