Skip to content

Commit

Permalink
Replace deprecated insights.chrome object with useChrome hook
Browse files Browse the repository at this point in the history
  • Loading branch information
dlabrecq committed Aug 17, 2023
1 parent c8deea4 commit 198cde1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/components/featureFlags/featureFlags.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useChrome } from '@redhat-cloud-services/frontend-components/useChrome';
import { useUnleashClient, useUnleashContext } from '@unleash/proxy-client-react';
import { useLayoutEffect, useRef } from 'react';
import { useDispatch } from 'react-redux';
Expand All @@ -21,14 +22,12 @@ const useFeatureFlags = () => {
const updateContext = useUnleashContext();
const client = useUnleashClient();
const dispatch = useDispatch();
const { auth } = useChrome();

const fetchUser = callback => {
const insights = (window as any).insights;
if (insights && insights.chrome && insights.chrome.auth && insights.chrome.auth.getUser) {
insights.chrome.auth.getUser().then(user => {
callback(user.identity.account_number);
});
}
auth.getUser().then(user => {
callback((user as any).identity.account_number);
});
};

const isMounted = useRef(false);
Expand Down

0 comments on commit 198cde1

Please sign in to comment.