Web: Files: Settings: fix routing

This commit is contained in:
Alexey Safronov 2022-09-14 14:54:02 +03:00
parent 45a79a0eff
commit 94859dfd24
3 changed files with 12 additions and 11 deletions

View File

@ -447,7 +447,7 @@ const Shell = ({ items = [], page = "home", ...rest }) => {
"/settings",
"/settings/common",
"/settings/admin",
"/settings/connected-clouds",
//"/settings/connected-clouds",
]}
component={FilesRoute}
/>

View File

@ -78,7 +78,11 @@ const FilesSection = React.memo(() => {
<Switch>
{/*<PrivateRoute exact path={HISTORY_URL} component={VersionHistory} />*/}
{/* <PrivateRoute path={"/private"} component={PrivateRoomsPage} /> */}
<PrivateRoute
exact
path={"/settings"}
component={() => <Redirect to="/settings/common" />}
/>
<PrivateRoute
exact
path={["/", "/rooms"]}
@ -128,9 +132,11 @@ const FilesSection = React.memo(() => {
/>
<PrivateRoute
exact
path={["/setiings", "/settings/:setting"]}
restricted
path={"/settings/admin"}
component={Settings}
/>
<PrivateRoute exact path={"/settings/common"} component={Settings} />
<PrivateRoute component={Error404Route} />
</Switch>
);

View File

@ -26,7 +26,7 @@ const StyledContainer = styled.div`
const SectionBodyContent = ({
setting,
isAdmin,
enableThirdParty,
//enableThirdParty,
settingsIsLoaded,
isErrorSettings,
history,
@ -76,11 +76,7 @@ const SectionBodyContent = ({
[setting, history]
);
return !settingsIsLoaded ? null : (!enableThirdParty &&
setting === "connected-clouds") ||
(!isAdmin && setting === "admin") ? (
<Error403 />
) : isErrorSettings ? (
return isErrorSettings ? (
<Error520 />
) : (
<StyledContainer>
@ -94,11 +90,10 @@ const SectionBodyContent = ({
};
export default inject(({ auth, settingsStore }) => {
const { enableThirdParty, settingsIsLoaded } = settingsStore;
const { settingsIsLoaded } = settingsStore;
return {
isAdmin: auth.isAdmin,
enableThirdParty,
settingsIsLoaded,
};
})(withRouter(observer(SectionBodyContent)));