Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32193675
D12603.1765099090.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D12603.1765099090.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
@@ -133,7 +133,7 @@
};
type UseLogOutOptions = {
- +logOutType?: 'legacy' | 'secondary_device',
+ +logOutType?: 'legacy' | 'primary_device' | 'secondary_device',
};
function useLogOut(
@@ -159,10 +159,21 @@
if (!identityClient) {
throw new Error('Identity service client is not initialized');
}
- const callIdentityClientLogOut =
- logOutType === 'secondary_device'
- ? identityClient.logOutSecondaryDevice
- : identityClient.logOut;
+ let callIdentityClientLogOut;
+ if (logOutType === 'primary_device') {
+ if (!identityClient.logOutPrimaryDevice) {
+ throw new Error(
+ 'logOutPrimaryDevice not defined. ' +
+ 'Are you calling it on non-primary device?',
+ );
+ }
+ callIdentityClientLogOut = identityClient.logOutPrimaryDevice;
+ } else {
+ callIdentityClientLogOut =
+ logOutType === 'secondary_device'
+ ? identityClient.logOutSecondaryDevice
+ : identityClient.logOut;
+ }
try {
await Promise.race([
callIdentityClientLogOut(),
@@ -235,6 +246,15 @@
}, [commServicesAccessToken, identityClient, preRequestUserState]);
}
+const primaryDeviceLogOutOptions = Object.freeze({
+ logOutType: 'primary_device',
+});
+
+function usePrimaryDeviceLogOut(): () => Promise<LogOutResult> {
+ const logOut = useLogOut(primaryDeviceLogOutOptions);
+ return logOut;
+}
+
const secondaryDeviceLogOutOptions = Object.freeze({
logOutType: 'secondary_device',
});
@@ -1301,6 +1321,7 @@
legacyLogInActionTypes,
useLogOut,
useIdentityLogOut,
+ usePrimaryDeviceLogOut,
useSecondaryDeviceLogOut,
logOutActionTypes,
legacyKeyserverRegister,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 7, 9:18 AM (14 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5843250
Default Alt Text
D12603.1765099090.diff (1 KB)
Attached To
Mode
D12603: [lib] Add usePrimaryDeviceLogOut hook
Attached
Detach File
Event Timeline
Log In to Comment