Web: fixed login route
This commit is contained in:
parent
2b2f5efc14
commit
899507000f
@ -5,13 +5,13 @@ import AppLoader from "../AppLoader";
|
||||
import { inject, observer } from "mobx-react";
|
||||
|
||||
export const PublicRoute = ({ component: Component, ...rest }) => {
|
||||
const { wizardCompleted, isAuthenticated, isLoaded } = rest;
|
||||
const { wizardCompleted, isAuthenticated, isLoaded, personal } = rest;
|
||||
const renderComponent = (props) => {
|
||||
if (!isLoaded) {
|
||||
return <AppLoader />;
|
||||
}
|
||||
|
||||
if (isAuthenticated) {
|
||||
if (isAuthenticated || personal) {
|
||||
return (
|
||||
<Redirect
|
||||
to={{
|
||||
@ -40,11 +40,12 @@ export const PublicRoute = ({ component: Component, ...rest }) => {
|
||||
|
||||
export default inject(({ auth }) => {
|
||||
const { settingsStore, isAuthenticated, isLoaded } = auth;
|
||||
const { wizardCompleted } = settingsStore;
|
||||
const { wizardCompleted, personal } = settingsStore;
|
||||
|
||||
return {
|
||||
wizardCompleted,
|
||||
isAuthenticated,
|
||||
isLoaded,
|
||||
personal,
|
||||
};
|
||||
})(observer(PublicRoute));
|
||||
|
@ -155,7 +155,6 @@ const Shell = ({ items = [], page = "home", ...rest }) => {
|
||||
isDesktop,
|
||||
language,
|
||||
FirebaseHelper,
|
||||
personal,
|
||||
} = rest;
|
||||
|
||||
useEffect(() => {
|
||||
@ -396,11 +395,7 @@ const Shell = ({ items = [], page = "home", ...rest }) => {
|
||||
<PrivateRoute exact path={HOME_URLS} component={HomeRoute} />
|
||||
<PublicRoute exact path={WIZARD_URL} component={WizardRoute} />
|
||||
<PrivateRoute path={ABOUT_URL} component={AboutRoute} />
|
||||
<PublicRoute
|
||||
exact
|
||||
path={personal ? "/" : LOGIN_URLS}
|
||||
component={LoginRoute}
|
||||
/>
|
||||
<PublicRoute exact path={LOGIN_URLS} component={LoginRoute} />
|
||||
<Route path={CONFIRM_URL} component={ConfirmRoute} />
|
||||
<PrivateRoute
|
||||
path={COMING_SOON_URLS}
|
||||
@ -430,8 +425,7 @@ const Shell = ({ items = [], page = "home", ...rest }) => {
|
||||
};
|
||||
|
||||
const ShellWrapper = inject(({ auth }) => {
|
||||
const { init, isLoaded, settingsStore } = auth;
|
||||
const { personal } = settingsStore;
|
||||
const { init, isLoaded } = auth;
|
||||
|
||||
return {
|
||||
loadBaseInfo: () => {
|
||||
@ -448,7 +442,6 @@ const ShellWrapper = inject(({ auth }) => {
|
||||
modules: auth.moduleStore.modules,
|
||||
isDesktop: auth.settingsStore.isDesktopClient,
|
||||
FirebaseHelper: auth.settingsStore.firebaseHelper,
|
||||
personal,
|
||||
};
|
||||
})(observer(Shell));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user