Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3305220
D13955.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.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 () => {
+ console.log('wylogowuje');
+ 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, Nov 19, 12:34 PM (20 h, 24 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2539384
Default Alt Text
D13955.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