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 Layout from "./components/Layout";
|
||||
import LoginLoading from "./components/LoginLoading";
|
||||
import {
|
||||
newPasswordPath,
|
||||
passwordResetPath,
|
||||
|
@ -33,20 +32,12 @@ export const UserContext = React.createContext<UserContext>({
|
|||
tokenVerifyLoading: false
|
||||
});
|
||||
|
||||
interface AuthRouterProps {
|
||||
hasToken: boolean;
|
||||
}
|
||||
|
||||
const AuthRouter: React.FC<AuthRouterProps> = ({ hasToken }) => (
|
||||
const AuthRouter: React.FC = () => (
|
||||
<Layout>
|
||||
<Switch>
|
||||
<Route path={passwordResetSuccessPath} component={ResetPasswordSuccess} />
|
||||
<Route path={passwordResetPath} component={ResetPassword} />
|
||||
{!hasToken ? (
|
||||
<Route path={newPasswordPath} component={NewPassword} />
|
||||
) : (
|
||||
<LoginLoading />
|
||||
)}
|
||||
<Route path={newPasswordPath} component={NewPassword} />
|
||||
<Route component={LoginView} />
|
||||
</Switch>
|
||||
</Layout>
|
||||
|
|
|
@ -293,7 +293,7 @@ const Routes: React.FC = () => {
|
|||
) : hasToken && tokenVerifyLoading ? (
|
||||
<LoginLoading />
|
||||
) : (
|
||||
<Auth hasToken={hasToken} />
|
||||
<Auth />
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue