Add logout button
Adds a button to the actions list allowing a user to logout.
@@ -175,6 +175,13 @@ export function Profile() {
setModalActive(false);
};
+ const logout = () => {
+ sessionStorage.removeItem('CANOPY_USER');
+ sessionStorage.removeItem('CANOPY_KEYS');
+ sessionStorage.removeItem('KEY_SECRET');
+ window.location.href = `${window.location.origin}/login`;
+ };
+
return (
<div id="profile">
<section className="user-info">
@@ -190,6 +197,9 @@ export function Profile() {
>
Change password
</button>
+ <button className="flat" onClick={logout}>
+ Logout
+ </button>
</ActionList>
</section>
<section className="user-keys">
