Web: fixed confirm route

This commit is contained in:
Nikita Gopienko 2021-03-17 15:56:09 +03:00
parent 1841730e20
commit 8036cb3401
3 changed files with 60 additions and 55 deletions

View File

@ -1,5 +1,5 @@
import React, { useEffect } from "react";
import { Router, Switch /*, Route*/ } from "react-router-dom";
import { Router, Switch, Route } from "react-router-dom";
import { inject, observer } from "mobx-react";
import NavMenu from "./components/NavMenu";
import Main from "./components/Main";
@ -37,6 +37,7 @@ const ComingSoon = React.lazy(() => import("./components/pages/ComingSoon"));
const ThirdPartyResponse = React.lazy(() =>
import("./components/pages/ThirdParty")
);
const Confirm = React.lazy(() => import("./components/pages/Confirm"));
const SettingsRoute = (props) => (
<React.Suspense fallback={<AppLoader />}>
@ -76,6 +77,14 @@ const HomeRoute = (props) => (
</React.Suspense>
);
const ConfirmRoute = (props) => (
<React.Suspense fallback={<AppLoader />}>
<ErrorBoundary>
<Confirm {...props} />
</ErrorBoundary>
</React.Suspense>
);
const LoginRoute = (props) => (
<React.Suspense fallback={<AppLoader />}>
<ErrorBoundary>
@ -234,6 +243,7 @@ const Shell = ({ items = [], page = "home", ...rest }) => {
]}
component={LoginRoute}
/>
<Route path={`${homepage}/confirm`} component={ConfirmRoute} />
<PrivateRoute
path={[
`${homepage}/coming-soon`,

View File

@ -17,58 +17,50 @@ const ChangeOwnerForm = lazy(() => import("./sub-components/changeOwner"));
const Confirm = ({ match, isLoaded }) => {
//console.log("Confirm render");
return !isLoaded ? (
<PageLayout>
<PageLayout.SectionBody>
<Loaders.Rectangle height="90vh" />
</PageLayout.SectionBody>
</PageLayout>
) : (
<Suspense fallback={null}>
<Switch>
<ConfirmRoute
forUnauthorized
path={`${match.path}/LinkInvite`}
component={CreateUserForm}
/>
<ConfirmRoute
forUnauthorized
path={`${match.path}/Activation`}
component={ActivateUserForm}
/>
<ConfirmRoute
exact
path={`${match.path}/EmailActivation`}
component={ActivateEmailForm}
/>
<ConfirmRoute
exact
path={`${match.path}/EmailChange`}
component={ChangeEmailForm}
/>
<ConfirmRoute
forUnauthorized
path={`${match.path}/PasswordChange`}
component={ChangePasswordForm}
/>
<ConfirmRoute
exact
path={`${match.path}/ProfileRemove`}
component={ProfileRemoveForm}
/>
<Route
exact
path={`${match.path}/PhoneActivation`}
component={ChangePhoneForm}
/>
<Route
exact
path={`${match.path}/ownerchange`}
component={ChangeOwnerForm}
/>
{/* <Route component={Error404} /> */}
</Switch>
</Suspense>
return (
<Switch>
<ConfirmRoute
forUnauthorized
path={`${match.path}/LinkInvite`}
component={CreateUserForm}
/>
<ConfirmRoute
forUnauthorized
path={`${match.path}/Activation`}
component={ActivateUserForm}
/>
<ConfirmRoute
exact
path={`${match.path}/EmailActivation`}
component={ActivateEmailForm}
/>
<ConfirmRoute
exact
path={`${match.path}/EmailChange`}
component={ChangeEmailForm}
/>
<ConfirmRoute
forUnauthorized
path={`${match.path}/PasswordChange`}
component={ChangePasswordForm}
/>
<ConfirmRoute
exact
path={`${match.path}/ProfileRemove`}
component={ProfileRemoveForm}
/>
<Route
exact
path={`${match.path}/PhoneActivation`}
component={ChangePhoneForm}
/>
<Route
exact
path={`${match.path}/ownerchange`}
component={ChangeOwnerForm}
/>
{/* <Route component={Error404} /> */}
</Switch>
);
};

View File

@ -234,8 +234,11 @@ class Confirm extends React.PureComponent {
};
render() {
console.log("createUser render");
const { settings, isConfirmLoaded, t, greetingTitle } = this.props;
const { settings, t, greetingTitle } = this.props;
const { isConfirmLoaded } = this.state;
console.log("createUser render", this.props);
return !isConfirmLoaded ? (
<Loader className="pageLoader" type="rombs" size="40px" />
) : (