mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-15 01:01:43 +10:00
set sentry user ID, if available and applicable
This commit is contained in:
17
client/wrappers/SentryWrapper.tsx
Normal file
17
client/wrappers/SentryWrapper.tsx
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import * as Sentry from '@sentry/nextjs';
|
||||||
|
import { useEffect } from 'react';
|
||||||
|
|
||||||
|
import { useAppSelector } from '@/store/hooks';
|
||||||
|
|
||||||
|
const SentryWrapper: React.FC<React.PropsWithChildren<unknown>> = ({ children }) => {
|
||||||
|
const user = useAppSelector((state) => state.auth.user);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const sentryUser: Sentry.User | null = user && { ...user, id: user?.id.toString() };
|
||||||
|
Sentry.setUser(sentryUser);
|
||||||
|
}, [user]);
|
||||||
|
|
||||||
|
return <>{children}</>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SentryWrapper;
|
||||||
@ -1,17 +1,18 @@
|
|||||||
import DateWrapper from './DateWrapper';
|
import DateWrapper from './DateWrapper';
|
||||||
import FontWrapper from './FontWrapper';
|
import FontWrapper from './FontWrapper';
|
||||||
|
import SentryWrapper from './SentryWrapper';
|
||||||
import ThemeWrapper from './ThemeWrapper';
|
import ThemeWrapper from './ThemeWrapper';
|
||||||
|
|
||||||
const WrapperRegistry: React.FC<React.PropsWithChildren<unknown>> = ({ children }) => {
|
const WrapperRegistry: React.FC<React.PropsWithChildren<unknown>> = ({ children }) => (
|
||||||
return (
|
|
||||||
<ThemeWrapper>
|
<ThemeWrapper>
|
||||||
<FontWrapper>
|
<FontWrapper>
|
||||||
<DateWrapper>
|
<DateWrapper>
|
||||||
|
<SentryWrapper>
|
||||||
<>{children}</>
|
<>{children}</>
|
||||||
|
</SentryWrapper>
|
||||||
</DateWrapper>
|
</DateWrapper>
|
||||||
</FontWrapper>
|
</FontWrapper>
|
||||||
</ThemeWrapper>
|
</ThemeWrapper>
|
||||||
);
|
);
|
||||||
};
|
|
||||||
|
|
||||||
export default WrapperRegistry;
|
export default WrapperRegistry;
|
||||||
|
|||||||
Reference in New Issue
Block a user