From c637feef1a14a3446f5e48a2a989908a382097bc Mon Sep 17 00:00:00 2001 From: Tushar Pandey Date: Mon, 20 Jan 2025 11:07:09 +0530 Subject: [PATCH] fix example application --- examples/cra-react-router/src/index.tsx | 18 ++++++++++++------ examples/cra-react-router/tsconfig.json | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/examples/cra-react-router/src/index.tsx b/examples/cra-react-router/src/index.tsx index 38c08ed6..3af442b1 100644 --- a/examples/cra-react-router/src/index.tsx +++ b/examples/cra-react-router/src/index.tsx @@ -1,27 +1,33 @@ import { createRoot } from "react-dom/client"; import React, { PropsWithChildren } from 'react'; -import App from './App.js'; -import { Auth0Provider, AppState } from '@auth0/auth0-react'; +import App from './App'; +import { Auth0Provider, AppState, Auth0ContextInterface, User } from '@auth0/auth0-react'; import { BrowserRouter, useNavigate } from 'react-router-dom'; import { Auth0ProviderOptions } from '../../../src/index.js'; const Auth0ProviderWithRedirectCallback = ({ children, + context, ...props -}: PropsWithChildren) => { +}: PropsWithChildren> & { + context?: React.Context> +}) => { const navigate = useNavigate(); - const onRedirectCallback = (appState?: AppState) => { + const onRedirectCallback = (appState?: AppState, user?: User) => { navigate((appState?.returnTo) || window.location.pathname); }; return ( - + {children} ); }; - const root = createRoot(document.getElementById('root')!); root.render( diff --git a/examples/cra-react-router/tsconfig.json b/examples/cra-react-router/tsconfig.json index a362d278..01b41a30 100644 --- a/examples/cra-react-router/tsconfig.json +++ b/examples/cra-react-router/tsconfig.json @@ -8,7 +8,7 @@ "allowSyntheticDefaultImports": true, "strict": true, "forceConsistentCasingInFileNames": true, - "module": "esnext", + "module": "NodeNext", "moduleResolution": "NodeNext", "resolveJsonModule": true, "isolatedModules": true,