From 4ae4e874689a71e33cdd7a5799fc0c85c4861367 Mon Sep 17 00:00:00 2001
From: Joseph Ditton <jditton.atomic@gmail.com>
Date: Mon, 22 Nov 2021 14:21:53 -0700
Subject: adds start for console

---
 client/components/home/_home.jsx | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

(limited to 'client/components/home/_home.jsx')

diff --git a/client/components/home/_home.jsx b/client/components/home/_home.jsx
index 59389ad..02ebe38 100644
--- a/client/components/home/_home.jsx
+++ b/client/components/home/_home.jsx
@@ -1,3 +1,23 @@
+import { useContext } from 'react';
+import { SettingsContext } from '../../utils/settings_context';
+
 export const Home = () => {
-  return <div>I am the home page</div>;
+  const [, dispatch] = useContext(SettingsContext);
+  const logout = async () => {
+    const res = await fetch('/sessions', {
+      method: 'DELETE',
+    });
+    if (res.status === 200) {
+      dispatch({ type: 'update', payload: { jwt: undefined } });
+    }
+  };
+
+  return (
+    <div>
+      <h1>Welcome</h1>
+      <button type="button" onClick={logout}>
+        Logout
+      </button>
+    </div>
+  );
 };
-- 
cgit v1.2.3-70-g09d2

