From 5407fdb936b6c4376e557c430bfc98e000ce0f05 Mon Sep 17 00:00:00 2001
From: Alberto Defendi <1369-ahl-berto@users.noreply.gitlab.inf.unibz.it>
Date: Thu, 22 Apr 2021 14:20:01 +0200
Subject: [PATCH] Initialize ProfilePage

---
 .../ProfilePage/ProfilePage.test.tsx          | 10 ++++++++
 src/components/ProfilePage/ProfilePage.tsx    | 23 +++++++++++++++++++
 2 files changed, 33 insertions(+)
 create mode 100644 src/components/ProfilePage/ProfilePage.test.tsx
 create mode 100644 src/components/ProfilePage/ProfilePage.tsx

diff --git a/src/components/ProfilePage/ProfilePage.test.tsx b/src/components/ProfilePage/ProfilePage.test.tsx
new file mode 100644
index 0000000..8b51893
--- /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 0000000..2fe6808
--- /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>
+  );
+};
-- 
GitLab