Web:Files:Сhanged history.pushState method to history.push.

This commit is contained in:
Vlada Gazizova 2022-01-19 12:27:17 +03:00
parent 5222666d2e
commit fde1f1c015
2 changed files with 11 additions and 2 deletions

View File

@ -6,6 +6,7 @@ import { AppServerConfig } from "@appserver/common/constants";
import { combineUrl } from "@appserver/common/utils";
import config from "../../package.json";
import { isMobile } from "react-device-detect";
import history from "@appserver/common/history";
export default function withFileActions(WrappedFileItem) {
class WithFileActions extends React.Component {
@ -153,9 +154,10 @@ export default function withFileActions(WrappedFileItem) {
if (encrypted && isPrivacy) return checkProtocol(item.id, true);
if (item.fileExst === ".png") {
const url = "#preview/" + item.id;
const url = "/products/files/#preview/" + item.id;
window.history.pushState(null, null, url);
//window.history.pushState(null, null, url);
history.push(url);
}
if (isTrashFolder) return;

View File

@ -39,6 +39,10 @@ const FilesMediaViewer = (props) => {
}
}, [removeQuery, onMediaFileClick]);
useEffect(() => {
console.log("previewFile", previewFile);
}, [previewFile]);
const removeQuery = (queryName) => {
const queryParams = new URLSearchParams(location.search);
@ -52,6 +56,7 @@ const FilesMediaViewer = (props) => {
const onMediaFileClick = (id) => {
//const itemId = typeof id !== "object" ? id : this.props.selection[0].id; TODO:
if (typeof id !== "object") {
const item = { visible: true, id };
setMediaViewerData(item);
@ -89,6 +94,8 @@ const FilesMediaViewer = (props) => {
setIsLoading(true);
setFirstLoad(true);
console.log("onMediaViewerClose");
fetchFiles(previewFile.folderId)
.then((data) => {
const pathParts = data.selectedFolder.pathParts;