Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jp pub pr 188 #200

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### Bug Fixes

- [#199](https://github.com/okta/okta-react/pull/199) Fixes okta-auth-js peer dependency error
- [#200](https://github.com/okta/okta-react/pull/200) Fixes: Typescript types when using `react-router-dom` v6 with `okta-react`

# 6.4.1

Expand Down
10 changes: 5 additions & 5 deletions src/SecureRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@

import * as React from 'react';
import { useOktaAuth, OnAuthRequiredFunction } from './OktaContext';
import { Route, useRouteMatch, RouteProps } from 'react-router-dom';
import * as ReactRouterDom from 'react-router-dom';
import { toRelativeUrl } from '@okta/okta-auth-js';
import OktaError from './OktaError';

const SecureRoute: React.FC<{
onAuthRequired?: OnAuthRequiredFunction;
errorComponent?: React.ComponentType<{ error: Error }>;
} & RouteProps & React.HTMLAttributes<HTMLDivElement>> = ({
} & ReactRouterDom.RouteProps & React.HTMLAttributes<HTMLDivElement>> = ({
onAuthRequired,
errorComponent,
...routeProps
...routeProps
}) => {
const { oktaAuth, authState, _onAuthRequired } = useOktaAuth();
const match = useRouteMatch(routeProps);
const match = ReactRouterDom.useRouteMatch(routeProps);
const pendingLogin = React.useRef(false);
const [handleLoginError, setHandleLoginError] = React.useState<Error | null>(null);
const ErrorReporter = errorComponent || OktaError;
Expand Down Expand Up @@ -86,7 +86,7 @@ const SecureRoute: React.FC<{
}

return (
<Route
<ReactRouterDom.Route
{ ...routeProps }
/>
);
Expand Down