diff options
author | Joseph Ditton <jditton.atomic@gmail.com> | 2021-11-22 14:21:53 -0700 |
---|---|---|
committer | Joseph Ditton <jditton.atomic@gmail.com> | 2021-11-22 14:21:53 -0700 |
commit | 4ae4e874689a71e33cdd7a5799fc0c85c4861367 (patch) | |
tree | d60c5d5f05ce0d0574bc168084e2b014ee999c1b /client/components/home | |
parent | 3902da1747a3e32db0b67f1162eafd4860b3d27a (diff) | |
download | locchat-4ae4e874689a71e33cdd7a5799fc0c85c4861367.tar.gz locchat-4ae4e874689a71e33cdd7a5799fc0c85c4861367.zip |
adds start for console
Diffstat (limited to 'client/components/home')
-rw-r--r-- | client/components/home/_home.jsx | 22 |
1 files changed, 21 insertions, 1 deletions
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> + ); }; |