Web: Added redirect with navigate. Added redirect to archives.
This commit is contained in:
parent
d53d615c5b
commit
c100b87933
@ -94,6 +94,15 @@ const FilesSection = React.memo(({ withMainButton }) => {
|
||||
}
|
||||
/>
|
||||
|
||||
<Route
|
||||
path="/archived"
|
||||
element={
|
||||
<PrivateRoute location={location}>
|
||||
<Navigate to="/rooms/archived" replace />
|
||||
</PrivateRoute>
|
||||
}
|
||||
/>
|
||||
|
||||
<Route
|
||||
path="/rooms"
|
||||
element={
|
||||
|
@ -33,6 +33,7 @@ import RoomsFilter from "@docspace/common/api/rooms/filter";
|
||||
import { getCategoryType } from "SRC_DIR/helpers/utils";
|
||||
import { CategoryType } from "SRC_DIR/helpers/constants";
|
||||
import { InfoPanelBodyContent, InfoPanelHeaderContent } from "./InfoPanel";
|
||||
import { RoomSearchArea } from "@docspace/common/constants";
|
||||
|
||||
class PureHome extends React.Component {
|
||||
componentDidMount() {
|
||||
@ -100,6 +101,12 @@ class PureHome extends React.Component {
|
||||
|
||||
if (!filterObj) {
|
||||
setIsLoading(true);
|
||||
|
||||
if (window.location.pathname.indexOf("/rooms/archived") !== -1) {
|
||||
this.fetchArchiveDefaultRooms();
|
||||
|
||||
return;
|
||||
}
|
||||
this.fetchDefaultRooms();
|
||||
|
||||
return;
|
||||
@ -258,6 +265,18 @@ class PureHome extends React.Component {
|
||||
});
|
||||
};
|
||||
|
||||
fetchArchiveDefaultRooms = () => {
|
||||
const { fetchRooms, setIsLoading, setFirstLoad } = this.props;
|
||||
|
||||
const filter = RoomsFilter.getDefault();
|
||||
filter.searchArea = RoomSearchArea.Archive;
|
||||
|
||||
fetchRooms(null, filter).finally(() => {
|
||||
setIsLoading(false);
|
||||
setFirstLoad(false);
|
||||
});
|
||||
};
|
||||
|
||||
onDrop = (files, uploadToFolder) => {
|
||||
const {
|
||||
t,
|
||||
|
@ -1,6 +1,7 @@
|
||||
import axios from "axios";
|
||||
import combineUrl from "./combineUrl";
|
||||
import defaultConfig from "PUBLIC_DIR/scripts/config.json";
|
||||
import history from "@docspace/common/history";
|
||||
|
||||
let { api: apiConf, proxy: proxyConf } = defaultConfig;
|
||||
let { orign: apiOrigin, prefix: apiPrefix, timeout: apiTimeout } = apiConf;
|
||||
@ -152,14 +153,15 @@ class AxiosClient {
|
||||
break;
|
||||
case 403:
|
||||
const pathname = window.location.pathname;
|
||||
const isArchived = pathname.indexOf("/rooms/archived") !== -1;
|
||||
|
||||
const isRooms =
|
||||
pathname.indexOf("/rooms/shared") !== -1 ||
|
||||
pathname.indexOf("/rooms/archived") !== -1;
|
||||
pathname.indexOf("/rooms/shared") !== -1 || isArchived;
|
||||
|
||||
if (!isRooms) return;
|
||||
|
||||
setTimeout(() => {
|
||||
window.location.replace("/");
|
||||
history.navigate(isArchived ? "/archived" : "/");
|
||||
}, 1000);
|
||||
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user