diff --git a/src/components/ProfilePage/ProfilePage.test.tsx b/src/components/ProfilePage/ProfilePage.test.tsx new file mode 100644 index 0000000000000000000000000000000000000000..8b518930c141e2eb630bfcdf6bb3efbfbafb5b89 --- /dev/null +++ b/src/components/ProfilePage/ProfilePage.test.tsx @@ -0,0 +1,10 @@ +import React from 'react'; +import { render } from '@testing-library/react'; +import { ProfilePage } from './ProfilePage'; + +describe('<ProfilePage />', () => { + it('renders without crashing', () => { + const wrapper = render(<ProfilePage />); + expect(wrapper.queryByTestId('ProfilePage')).toBeTruthy(); + }); +}); diff --git a/src/components/ProfilePage/ProfilePage.tsx b/src/components/ProfilePage/ProfilePage.tsx new file mode 100644 index 0000000000000000000000000000000000000000..2fe6808acc4b7876ad3bc9730c53f78b1d11547d --- /dev/null +++ b/src/components/ProfilePage/ProfilePage.tsx @@ -0,0 +1,23 @@ +import React, { FC } from 'react'; +import Button from '@material-ui/core/Button'; +import axios from 'axios'; +import { NonAuthRoutes } from 'components/api/routes'; +import { useHistory } from 'react-router-dom'; + +export const ProfilePage: FC = () => { + const history = useHistory(); + + const logout = (): void => { + axios + .post('/api/web/login/logout') + .then(() => history.replace(NonAuthRoutes.home)); + }; + + return ( + <div data-testid="ProfilePage"> + <Button variant="outlined" color="default" onClick={logout}> + Logout + </Button> + </div> + ); +};