Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3520732
D13955.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D13955.id.diff
View Options
diff --git a/lib/actions/user-actions.js b/lib/actions/user-actions.js
--- a/lib/actions/user-actions.js
+++ b/lib/actions/user-actions.js
@@ -91,6 +91,7 @@
import { authoritativeKeyserverID } from '../utils/authoritative-keyserver.js';
import { getConfig } from '../utils/config.js';
import { getMessageForException } from '../utils/errors.js';
+import { useDispatchActionPromise } from '../utils/redux-promise-utils.js';
import { useSelector } from '../utils/redux-utils.js';
import { usingCommServicesAccessToken } from '../utils/services-utils.js';
import sleep from '../utils/sleep.js';
@@ -267,6 +268,39 @@
}, [commServicesAccessToken, identityClient, preRequestUserState]);
}
+function useInvalidCSATLogOut(): () => Promise<void> {
+ const dispatchActionPromise = useDispatchActionPromise();
+
+ const preRequestUserState = usePreRequestUserState();
+ const callKeyserverLogOut = useKeyserverCall(keyserverLogOut);
+
+ const commServicesAccessToken = useSelector(
+ state => state.commServicesAccessToken,
+ );
+
+ return React.useCallback(() => {
+ const keyserverLogOutPromise = async () => {
+ // errors are swallowed inside `keyserverLogOut` above
+ const { keyserverIDs: _, ...result } = await callKeyserverLogOut({
+ preRequestUserState,
+ });
+ return {
+ ...result,
+ preRequestUserState: {
+ ...result.preRequestUserState,
+ commServicesAccessToken,
+ },
+ };
+ };
+ return dispatchActionPromise(logOutActionTypes, keyserverLogOutPromise());
+ }, [
+ dispatchActionPromise,
+ commServicesAccessToken,
+ callKeyserverLogOut,
+ preRequestUserState,
+ ]);
+}
+
const primaryDeviceLogOutOptions = Object.freeze({
logOutType: 'primary_device',
});
@@ -1449,4 +1483,5 @@
processNewUserIDsActionType,
versionSupportedByIdentityActionTypes,
useVersionSupportedByIdentity,
+ useInvalidCSATLogOut,
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 24, 1:12 AM (13 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2697707
Default Alt Text
D13955.id.diff (1 KB)
Attached To
Mode
D13955: [lib] Add hook to log out on invalid CSAT
Attached
Detach File
Event Timeline
Log In to Comment