App.tsx
453 Bytes
import React, { Fragment } from "react";
import { Switch, Route, Redirect } from "react-router-dom";
import { Login } from "auth/Login";
import { useAuth } from "auth/useAuth";
export function App() {
const { token, login } = useAuth();
return (
<Fragment>
<Switch>
<Route path="/login">
<Login login={login} />
</Route>
</Switch>
{token === null && <Redirect to="/login" />}
</Fragment>
);
}