Skip to content

Commit

Permalink
feat: add save organization analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
mattystank committed May 3, 2024
1 parent fe98614 commit 53b6f27
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/app/components/onc-organization/onc-organization.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import React, { useEffect, useState } from 'react';
import React, { useContext, useEffect, useState } from 'react';
import { bool, func, string } from 'prop-types';
import ReactGA from 'react-ga4';

import ChplOncOrganizationEdit from './onc-organization-edit';
import ChplOncOrganizationView from './onc-organization-view';

import { usePostAcb, usePutAcb } from 'api/acbs';
import { usePostAtl, usePutAtl } from 'api/atls';
import { UserContext } from 'shared/contexts';
import { acb as acbPropType } from 'shared/prop-types';

function ChplOncOrganization(props) {
Expand All @@ -15,6 +17,7 @@ function ChplOncOrganization(props) {
orgType,
isCreating,
} = props;
const { hasAnyRole } = useContext(UserContext);
const [isEditing, setIsEditing] = useState(false);
const [isProcessing, setIsProcessing] = useState(false);
const [organization, setOrganization] = useState(undefined);
Expand Down Expand Up @@ -45,6 +48,11 @@ function ChplOncOrganization(props) {
onSuccess: () => {
setIsEditing(false);
setIsProcessing(false);
ReactGA.event('save', {
category: 'Organizations',
label: organization.name,
group: hasAnyRole(['chpl-admin']) ? 'chpl-admin' : (hasAnyRole['chpl-onc'] ? 'chpl-onc' : 'chpl-onc-acb'),
});
dispatch('edit', '');
},
onError: (error) => {
Expand Down

0 comments on commit 53b6f27

Please sign in to comment.