Fix endless loading screen
This commit is contained in:
parent
7be748eed7
commit
987315edb2
2 changed files with 3 additions and 12 deletions
|
@ -3,7 +3,6 @@ import React from "react";
|
||||||
import { Route, Switch } from "react-router-dom";
|
import { Route, Switch } from "react-router-dom";
|
||||||
|
|
||||||
import Layout from "./components/Layout";
|
import Layout from "./components/Layout";
|
||||||
import LoginLoading from "./components/LoginLoading";
|
|
||||||
import {
|
import {
|
||||||
newPasswordPath,
|
newPasswordPath,
|
||||||
passwordResetPath,
|
passwordResetPath,
|
||||||
|
@ -33,20 +32,12 @@ export const UserContext = React.createContext<UserContext>({
|
||||||
tokenVerifyLoading: false
|
tokenVerifyLoading: false
|
||||||
});
|
});
|
||||||
|
|
||||||
interface AuthRouterProps {
|
const AuthRouter: React.FC = () => (
|
||||||
hasToken: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
const AuthRouter: React.FC<AuthRouterProps> = ({ hasToken }) => (
|
|
||||||
<Layout>
|
<Layout>
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route path={passwordResetSuccessPath} component={ResetPasswordSuccess} />
|
<Route path={passwordResetSuccessPath} component={ResetPasswordSuccess} />
|
||||||
<Route path={passwordResetPath} component={ResetPassword} />
|
<Route path={passwordResetPath} component={ResetPassword} />
|
||||||
{!hasToken ? (
|
<Route path={newPasswordPath} component={NewPassword} />
|
||||||
<Route path={newPasswordPath} component={NewPassword} />
|
|
||||||
) : (
|
|
||||||
<LoginLoading />
|
|
||||||
)}
|
|
||||||
<Route component={LoginView} />
|
<Route component={LoginView} />
|
||||||
</Switch>
|
</Switch>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|
|
@ -293,7 +293,7 @@ const Routes: React.FC = () => {
|
||||||
) : hasToken && tokenVerifyLoading ? (
|
) : hasToken && tokenVerifyLoading ? (
|
||||||
<LoginLoading />
|
<LoginLoading />
|
||||||
) : (
|
) : (
|
||||||
<Auth hasToken={hasToken} />
|
<Auth />
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue