Skip to content

Commit

Permalink
Fix ProtectedRoute types
Browse files Browse the repository at this point in the history
  • Loading branch information
nathandf committed Jun 27, 2024
1 parent 8379b75 commit 63ad6dc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/tapisui-common/src/ui/ProtectedRoute/ProtectedRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ import { Route, Redirect, RouteComponentProps } from 'react-router-dom';

// A wrapper for <Route> that redirects to the login
// screen if you're not yet authenticated.
type ProtectedRouteProps = RouteComponentProps & { accessToken: string };
type ProtectedRouteProps = RouteComponentProps & { accessToken: string | undefined, path: string };

const ProtectedRoute: React.FC<
React.PropsWithChildren<ProtectedRouteProps>
> = ({ accessToken, children, ...rest }) => {
> = ({ accessToken, path, children, ...rest }) => {
return (
<Route
{...rest}
path={path}
render={({ location }: RouteComponentProps) =>
accessToken ? (
children
Expand Down

0 comments on commit 63ad6dc

Please sign in to comment.