Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjmcgrath committed Apr 4, 2022
1 parent d8e7db4 commit 69a2e25
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
18 changes: 11 additions & 7 deletions __tests__/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ export const createWrapper = ({
clientId = '__test_client_id__',
domain = '__test_domain__',
...opts
}: Partial<Auth0ClientOptions> = {}) => ({
children,
}: PropsWithChildren<{}>): JSX.Element => (
<Auth0Provider domain={domain} clientId={clientId} {...opts}>
{children}
</Auth0Provider>
);
}: Partial<Auth0ClientOptions> = {}) => {
return function Wrapper({
children,
}: PropsWithChildren<Record<string, unknown>>): JSX.Element {
return (
<Auth0Provider domain={domain} clientId={clientId} {...opts}>
{children}
</Auth0Provider>
);
};
};
2 changes: 1 addition & 1 deletion examples/gatsby-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dependencies": {
"@auth0/auth0-react": "file:../..",
"bootstrap": "^4.5.0",
"gatsby": "^2.22.15",
"gatsby": "^3.14.6",
"gatsby-image": "^2.4.5",
"gatsby-plugin-create-client-paths": "^2.3.4",
"gatsby-plugin-manifest": "^2.4.9",
Expand Down
18 changes: 11 additions & 7 deletions src/with-auth0.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ export interface WithAuth0Props {
*/
const withAuth0 = <P extends WithAuth0Props>(
Component: ComponentType<P>
): ComponentType<Omit<P, keyof WithAuth0Props>> => (props): JSX.Element => (
<Auth0Context.Consumer>
{(auth: Auth0ContextInterface): JSX.Element => (
<Component {...(props as P)} auth0={auth} />
)}
</Auth0Context.Consumer>
);
): ComponentType<Omit<P, keyof WithAuth0Props>> => {
return function WithAuth(props): JSX.Element {
return (
<Auth0Context.Consumer>
{(auth: Auth0ContextInterface): JSX.Element => (
<Component {...(props as P)} auth0={auth} />
)}
</Auth0Context.Consumer>
);
};
};

export default withAuth0;

0 comments on commit 69a2e25

Please sign in to comment.