Page MenuHomePhabricator

D4847.id15645.diff
No OneTemporary

D4847.id15645.diff

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,9 +2,12 @@
import * as React from 'react';
-import { logOut } from 'lib/actions/user-actions';
+import { logOut, logOutActionTypes } from 'lib/actions/user-actions';
import { preRequestUserStateSelector } from 'lib/selectors/account-selectors';
-import { useServerCall } from 'lib/utils/action-utils';
+import {
+ useDispatchActionPromise,
+ useServerCall,
+} from 'lib/utils/action-utils';
import { useModalContext } from '../modals/modal-provider.react';
import { useSelector } from '../redux/redux-utils';
@@ -17,9 +20,15 @@
function AccountSettings(): React.Node {
const sendLogoutRequest = useServerCall(logOut);
const preRequestUserState = useSelector(preRequestUserStateSelector);
- const logOutUser = React.useCallback(() => {
- sendLogoutRequest(preRequestUserState);
- }, [sendLogoutRequest, preRequestUserState]);
+ const dispatchActionPromise = useDispatchActionPromise();
+ const logOutUser = React.useCallback(
+ () =>
+ dispatchActionPromise(
+ logOutActionTypes,
+ sendLogoutRequest(preRequestUserState),
+ ),
+ [dispatchActionPromise, preRequestUserState, sendLogoutRequest],
+ );
const { pushModal, popModal } = useModalContext();
const showPasswordChangeModal = React.useCallback(

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 2:39 AM (21 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2572779
Default Alt Text
D4847.id15645.diff (1 KB)

Event Timeline