Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3351575
D11200.id37712.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
D11200.id37712.diff
View Options
diff --git a/lib/utils/identity-search-utils.js b/lib/utils/identity-search-utils.js
--- a/lib/utils/identity-search-utils.js
+++ b/lib/utils/identity-search-utils.js
@@ -4,16 +4,20 @@
import * as React from 'react';
import { usingCommServicesAccessToken } from './services-utils.js';
+import { isLoggedIn } from '../selectors/user-selectors.js';
import { IdentityClientContext } from '../shared/identity-client-context.js';
import { type IdentitySearchAuthMessage } from '../types/identity-search/auth-message-types.js';
+import { useSelector } from '../utils/redux-utils.js';
export function useGetIdentitySearchAuthMessage(): () => Promise<?IdentitySearchAuthMessage> {
+ const loggedIn = useSelector(isLoggedIn);
+
const identityContext = React.useContext(IdentityClientContext);
invariant(identityContext, 'Identity context should be set');
const getAuthMetadata = identityContext.getAuthMetadata;
return React.useCallback(async () => {
- if (!getAuthMetadata || !usingCommServicesAccessToken) {
+ if (!loggedIn || !usingCommServicesAccessToken) {
return null;
}
@@ -24,6 +28,7 @@
!authMetadata.deviceID ||
!authMetadata.accessToken
) {
+ console.log('Error getting auth message: authMetadata incomplete');
return null;
}
@@ -33,5 +38,5 @@
deviceID: authMetadata?.deviceID,
accessToken: authMetadata?.accessToken,
};
- }, [getAuthMetadata]);
+ }, [getAuthMetadata, loggedIn]);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 2:35 AM (21 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2573562
Default Alt Text
D11200.id37712.diff (1 KB)
Attached To
Mode
D11200: [lib] Handle logged in / logged out case in useGetIdentitySearchAuthMessage
Attached
Detach File
Event Timeline
Log In to Comment