sforkowany z mirror/soapbox
Remove redirect code from PublicLayout
rodzic
6f0e398a78
commit
e9a48b45e1
|
@ -2,7 +2,7 @@ import React from 'react';
|
||||||
import { Switch, Route, Redirect } from 'react-router-dom';
|
import { Switch, Route, Redirect } from 'react-router-dom';
|
||||||
|
|
||||||
import LandingGradient from 'soapbox/components/landing-gradient';
|
import LandingGradient from 'soapbox/components/landing-gradient';
|
||||||
import { useAppSelector, useSoapboxConfig } from 'soapbox/hooks';
|
import { useAppSelector } from 'soapbox/hooks';
|
||||||
import { isStandalone } from 'soapbox/utils/state';
|
import { isStandalone } from 'soapbox/utils/state';
|
||||||
|
|
||||||
import AboutPage from '../about';
|
import AboutPage from '../about';
|
||||||
|
@ -13,9 +13,6 @@ import Header from './components/header';
|
||||||
|
|
||||||
const PublicLayout = () => {
|
const PublicLayout = () => {
|
||||||
const standalone = useAppSelector((state) => isStandalone(state));
|
const standalone = useAppSelector((state) => isStandalone(state));
|
||||||
const soapboxConfig = useSoapboxConfig();
|
|
||||||
|
|
||||||
const shouldRedirectFromRoot = soapboxConfig.redirectRootNoLogin && !soapboxConfig.redirectRootNoLogin.match(/^\/?$/);
|
|
||||||
|
|
||||||
if (standalone) {
|
if (standalone) {
|
||||||
return <Redirect to='/login/external' />;
|
return <Redirect to='/login/external' />;
|
||||||
|
@ -31,11 +28,7 @@ const PublicLayout = () => {
|
||||||
|
|
||||||
<div className='relative'>
|
<div className='relative'>
|
||||||
<Switch>
|
<Switch>
|
||||||
{shouldRedirectFromRoot ? (
|
|
||||||
<Redirect exact path='/' to={soapboxConfig.redirectRootNoLogin} />
|
|
||||||
) : (
|
|
||||||
<Route exact path='/' component={LandingPage} />
|
<Route exact path='/' component={LandingPage} />
|
||||||
)}
|
|
||||||
<Route exact path='/about/:slug?' component={AboutPage} />
|
<Route exact path='/about/:slug?' component={AboutPage} />
|
||||||
</Switch>
|
</Switch>
|
||||||
</div>
|
</div>
|
||||||
|
|
Ładowanie…
Reference in New Issue