diff --git a/web/settings/account-settings.css b/web/settings/account-settings.css --- a/web/settings/account-settings.css +++ b/web/settings/account-settings.css @@ -22,6 +22,9 @@ border-bottom: 1px solid var(--border-color); padding: 16px; margin-bottom: 8px; + display: flex; + flex-direction: row; + justify-content: space-between; } .logoutContainer { @@ -38,3 +41,13 @@ .username { color: var(--fg); } + +.button { + color: var(--account-button-color); + background-color: transparent; + font-size: var(--m-font-16); + border: none; + cursor: pointer; + line-height: var(--line-height-text); + white-space: nowrap; +} diff --git a/web/settings/account-settings.react.js b/web/settings/account-settings.react.js --- a/web/settings/account-settings.react.js +++ b/web/settings/account-settings.react.js @@ -2,6 +2,10 @@ import * as React from 'react'; +import { logOut } from 'lib/actions/user-actions'; +import { preRequestUserStateSelector } from 'lib/selectors/account-selectors'; +import { useServerCall } from 'lib/utils/action-utils'; + import { useSelector } from '../redux/redux-utils'; import css from './account-settings.css'; @@ -12,6 +16,12 @@ ? currentUserInfo.username : undefined; + const sendLogoutRequest = useServerCall(logOut); + const preRequestUserState = useSelector(preRequestUserStateSelector); + const logOutUser = React.useCallback(() => { + sendLogoutRequest(preRequestUserState); + }, [sendLogoutRequest, preRequestUserState]); + return (