App.js: Update to use useChrome hook
This commit updates App.js to take advantage of the useChrome hook. `init` and `identifyApp` are deprecated and have been removed. The Chrome API documentation can be found here: http://front-end-docs-insights.apps.ocp4.prod.psi.redhat.com/chrome/chrome-api
This commit is contained in:
parent
b2e6e3cf04
commit
ef1d077c2e
1 changed files with 6 additions and 7 deletions
13
src/App.js
13
src/App.js
|
|
@ -1,5 +1,6 @@
|
|||
import React, { useEffect } from 'react';
|
||||
|
||||
import useChrome from '@redhat-cloud-services/frontend-components/useChrome';
|
||||
import NotificationsPortal from '@redhat-cloud-services/frontend-components-notifications/NotificationPortal';
|
||||
import { useStore } from 'react-redux';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
|
@ -12,14 +13,12 @@ const App = (props) => {
|
|||
const navigate = useNavigate();
|
||||
const store = useStore();
|
||||
|
||||
const { hideGlobalFilter, on, updateDocumentTitle } = useChrome();
|
||||
|
||||
useEffect(() => {
|
||||
document.title = 'Image Builder | Red Hat Insights';
|
||||
insights.chrome.init();
|
||||
insights.chrome.identifyApp('image-builder');
|
||||
insights.chrome.hideGlobalFilter();
|
||||
const unregister = insights.chrome.on('APP_NAVIGATION', () =>
|
||||
navigate(resolveRelPath(''))
|
||||
);
|
||||
updateDocumentTitle('Image Builder | Red Hat Insights');
|
||||
hideGlobalFilter();
|
||||
const unregister = on('APP_NAVIGATION', () => navigate(resolveRelPath('')));
|
||||
return () => {
|
||||
unregister();
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue