mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
19 lines
548 B
TypeScript
19 lines
548 B
TypeScript
import {useContext} from 'react';
|
|
|
|
import HookStore from 'sentry/stores/hookStore';
|
|
import {RouteAnalyticsContext} from 'sentry/views/routeAnalyticsContextProvider';
|
|
|
|
/**
|
|
* Sets the organization for route analytics events.
|
|
* Only needs to be used once for the entire app just
|
|
* below the Organization context.
|
|
*/
|
|
export default function useRouteAnalyticsHookSetup() {
|
|
const {setOrganization} = useContext(RouteAnalyticsContext);
|
|
HookStore.persistCallback(
|
|
'react-hook:route-activated',
|
|
'setOrganization',
|
|
setOrganization
|
|
);
|
|
}
|