Skip to content

Commit

Permalink
Add language to DataDog user
Browse files Browse the repository at this point in the history
  • Loading branch information
canac committed May 14, 2024
1 parent cd0696f commit c3dbce2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/DataDog/DataDog.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { useRouter } from 'next/router';
import React, { useEffect } from 'react';
import { useSession } from 'next-auth/react';
import { useTranslation } from 'react-i18next';
import { setDataDogUser } from 'src/lib/dataDog';

const DataDog: React.FC = () => {
const {
i18n: { language },
} = useTranslation();
const { query } = useRouter();
const { data: session } = useSession();

Expand All @@ -21,9 +25,10 @@ const DataDog: React.FC = () => {
accountListId,
name: user.name,
email: user.email,
language,
});
}
}, [user, accountListId]);
}, [user, accountListId, language]);

return null;
};
Expand Down
1 change: 1 addition & 0 deletions src/lib/dataDog.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const setDataDogUserMock = {
accountListId: '1234-4567-8910-1112-1314',
name: 'Roger',
email: '[email protected]',
language: 'en-us',
};

describe('dataDog', () => {
Expand Down
3 changes: 3 additions & 0 deletions src/lib/dataDog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface SetDataDogUserProps {
name: string;
email: string;
accountListId: string | null;
language: string;
}

export const accountListIdsStorageKey = 'accountListIds';
Expand All @@ -31,6 +32,7 @@ export const setDataDogUser = ({
name,
email,
accountListId,
language,
}: SetDataDogUserProps): void => {
if (!isDataDogConfigured()) {
return;
Expand All @@ -51,6 +53,7 @@ export const setDataDogUser = ({
name,
email,
accountListIds,
language,
});
};

Expand Down

0 comments on commit c3dbce2

Please sign in to comment.