Generate Token through Auth0

This commit is contained in:
Charles Bochet
2023-01-27 12:12:04 +01:00
parent 54acb16db8
commit 8e0dc44bf6
21 changed files with 3616 additions and 2344 deletions

View File

@ -0,0 +1,10 @@
import AuthService from '../hooks/AuthenticationHooks';
function RequireAuth({ children }: { children: JSX.Element }): JSX.Element {
const { redirectIfNotLoggedIn } = AuthService;
redirectIfNotLoggedIn();
return children;
}
export default RequireAuth;

View File

@ -0,0 +1,14 @@
import RequireAuth from '../RequireAuth';
import Navbar from '../RequireAuth';
export default {
title: 'RequireAuth',
component: Navbar,
};
export const RequireAuthWithHelloChild = () => (
<RequireAuth>
<div>Hello</div>
</RequireAuth>
);

View File

@ -0,0 +1,9 @@
import { render } from '@testing-library/react';
import { RequireAuthWithHelloChild } from '../__stories__/RequireAuth.stories';
it('Checks the Require Auth renders', () => {
const { getAllByText } = render(<RequireAuthWithHelloChild />);
expect(getAllByText('Hello')).toBeTruthy();
});